<div dir="ltr">In the ionic app when do you do the registration of UPS ? on the platformReady event ? </div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 4:54 PM, Rob Willett <span dir="ltr">&lt;<a href="mailto:rob.aerogear@robertwillett.com" target="_blank">rob.aerogear@robertwillett.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Erik,<br>
<br>
We have built the simplest possible app we can that uses the Aerogear<br>
push plugin but using the ionic tabs starter kit.<br>
<br>
<a href="http://ionicframework.com/getting-started/" rel="noreferrer" target="_blank">http://ionicframework.com/getting-started/</a><br>
<br>
We have taken the code directly from the Cordova simple app that we have<br>
got working and put it into the Ionic app.<br>
<br>
if we follow your tests as below:<br>
<br>
1. IOS App in foreground, we send a simple push notification from the<br>
Aerogear console - Works OK, We can see the event. Good<br>
<br>
2. IOS App in background, we send a simple push notification from the<br>
Aerogear console - Works OK, We can see the event. Good<br>
<br>
3. IOS App killed, we send a simple push notification from the Aerogear<br>
console and some of the time when we click on the notification in the<br>
notification drawer we do NOT get the notification handler called. Not<br>
so good<br>
<br>
However it does appear to work most of the time with our minimal Ionic<br>
app, but some of the time it fails. We had a run of 1 in 2 failures when<br>
we click on the notification. Now we have just done 20 runs in a row,<br>
each time killing the app after receiving the notification and not a<br>
single failure. Nothing changed.<br>
<br>
We cannot find any obvious reason for this so we are still<br>
investigating.<br>
<br>
We have reconfigured our main app to work the same way as the minimal<br>
app but we are still getting the same issues as before, we can see the<br>
notification in the drawer but clicking on it does NOT call the same<br>
handler with the same code as the minimal app. We get zero calls to the<br>
notification event handler.<br>
<br>
We are wondering if there is a timing issue somewhere in our code, but<br>
we can’t see it. We also wondered if the size of the code we are<br>
loading is the cause of a timing issue as well.<br>
<br>
Is there any way of adding more debugging into the Aerogear push plugin<br>
to see if we can track things down that way?<br>
<br>
Its very frustrating, but thanks for your help to date. It does look<br>
like its an interaction with our code, Ionic and the Aerogear plugin. My<br>
money is on our code though. We’ll now start pulling working code out<br>
of our app until we get back to the minimal app. Only 18,604 lines to go<br>
:)<br>
<span class=""><br>
Rob<br>
<br>
On 15 Dec 2015, at 10:36, Erik Jan de Wit wrote:<br>
<br>
</span><div><div class="h5">&gt; Hi Rob,<br>
&gt;<br>
&gt; That would be a bug, although I can not reproduce it, to test it this<br>
&gt; is<br>
&gt; what I&#39;ve done to test it:<br>
&gt; $ &gt; cordova create push-test &lt;my bundle id&gt;<br>
&gt; $ &gt; cordova platform add ios<br>
&gt; $ &gt; cordova plugin add aerogear-cordova-push<br>
&gt;<br>
&gt; copy paste your js code into www/js/index.js onDeviceReady, changed<br>
&gt; pushServerUrl and variant info and changed quotes to &quot; (this is your<br>
&gt; email<br>
&gt; client no doubt) and changed : into ; after console.log(&quot;Success&quot;)<br>
&gt;<br>
&gt;<br>
&gt; Attach Safari debugger and send a message when the app is in the<br>
&gt; foreground<br>
&gt; and get in the console:<br>
&gt;<br>
&gt; HandleAeroGearNotification: event =&gt;<br>
&gt; {&quot;alert&quot;:&quot;test&quot;,&quot;foreground&quot;:true,&quot;coldstart&quot;:false,&quot;sound&quot;:&quot;default&quot;,&quot;badge&quot;:-1,&quot;payload&quot;:{}}<br>
&gt;<br>
&gt; I press the home button and send the app to the background send<br>
&gt; another<br>
&gt; message and &#39;touch&#39; the message to launch the app:<br>
&gt;<br>
&gt; HandleAeroGearNotification: event =&gt;<br>
&gt; {&quot;alert&quot;:&quot;background&quot;,&quot;foreground&quot;:false,&quot;coldstart&quot;:false,&quot;sound&quot;:&quot;default&quot;,&quot;badge&quot;:-1,&quot;payload&quot;:{}}<br>
&gt;<br>
&gt; The I kill the app by pressing home twice and swiping over the app to<br>
&gt; remove it send another message and &#39;touch&#39; it to launch the app. This<br>
&gt; kills<br>
&gt; my safari debugger so no way to see the console log, but in this case<br>
&gt; coldstart should be true. To test this better changed the code to<br>
&gt; alert<br>
&gt; instead of console:<br>
&gt;<br>
&gt; function HandleAeroGearNotification(event) {<br>
&gt;    alert(&quot;HandleAeroGearNotification: event =&gt; &quot; + event.coldstart);<br>
&gt;<br>
&gt;    // Stuff cut for clarity<br>
&gt; }<br>
&gt;<br>
&gt; I send another notification &#39;touch&#39; it to launch the app and see the<br>
&gt; alert<br>
&gt; box display the text:<br>
&gt;<br>
&gt; HandleAeroGearNotification: event =&gt; true<br>
&gt;<br>
&gt; Hope this helps<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Dec 14, 2015 at 10:20 PM, Rob Willett &lt;<br>
&gt; <a href="mailto:rob.aerogear@robertwillett.com">rob.aerogear@robertwillett.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt; We think we have found a possible bug in the Aerogear Cordova 2.0.4<br>
&gt;&gt; push<br>
&gt;&gt; plugin specifically on the iOS side.<br>
&gt;&gt; Summary<br>
&gt;&gt;<br>
&gt;&gt; We have two versions of our app, an Android and an IOS version. Both<br>
&gt;&gt; use<br>
&gt;&gt; the latest Cordova push plugin 2.0.4. They also both have the latest<br>
&gt;&gt; Cordova platforms, android 4.1.1, ios 3.9.2. Both the iOS and Android<br>
&gt;&gt; versions are compiled at the same time. We are running cordova 5.3.3<br>
&gt;&gt; with<br>
&gt;&gt; Ionic 1.7.8 (?).<br>
&gt;&gt;<br>
</div></div>&gt;&gt; 1.<br>
<span class="">&gt;&gt;<br>
&gt;&gt; We make sure that both apps are NOT started up on each device. We<br>
&gt;&gt; also<br>
&gt;&gt; check they are NOT in the background.<br>
</span>&gt;&gt; 2.<br>
<span class="">&gt;&gt;<br>
&gt;&gt; We send the same simple notification to each device. This<br>
&gt;&gt; notification<br>
&gt;&gt; config is as below, we have anonymised the variants and alias in this<br>
&gt;&gt; JSON<br>
&gt;&gt; structure, though we can report that the UPS server sends the data<br>
&gt;&gt; correctly. We use the additionalData flag to provide the information<br>
&gt;&gt; necessary to decide which notification has been clicked in the<br>
&gt;&gt; notification<br>
&gt;&gt; drawer.<br>
&gt;&gt;<br>
&gt;&gt; &#39;variants&#39; =&gt; [‘variant1’,’variant2’ ],<br>
&gt;&gt; &#39;message&#39; =&gt; {<br>
&gt;&gt;  &#39;additionalData&#39; =&gt; { &#39;Disruption_Id&#39; =&gt; &#39;107546&#39;,<br>
&gt;&gt;                       &#39;EpochTime&#39; =&gt; &#39;1450125268&#39;<br>
&gt;&gt;                      },<br>
&gt;&gt;  &#39;alert&#39; =&gt; &#39;Cannon Street (EC4N) (All Directions) at the junction of<br>
&gt;&gt; King William Street - To facilitate a heavy lift in Cannon Street,<br>
&gt;&gt; Cannon Street will be closed. Traffic is slow moving on diversion.&#39;<br>
&gt;&gt; },<br>
&gt;&gt;  &#39;alias&#39; =&gt; [ ‘alias1’ ],<br>
&gt;&gt;  &#39;ttl&#39; =&gt; 600<br>
&gt;&gt; };<br>
&gt;&gt;<br>
&gt;&gt;<br>
</span>&gt;&gt; 1.<br>
<span class="">&gt;&gt;<br>
&gt;&gt; Both devices show the message, the Android device stacks the message<br>
&gt;&gt; and the iOS device display an individual message. This looks correct.<br>
</span>&gt;&gt; 2.<br>
<span class="">&gt;&gt;<br>
&gt;&gt; Clicking on the Android stacked message starts up the app and the<br>
&gt;&gt; Javascript notification handler we have defined,<br>
&gt;&gt; HandleAeroGearNotification<br>
&gt;&gt; is called<br>
&gt;&gt;<br>
&gt;&gt; HandleAeroGearNotification: event =&gt; {&quot;alert&quot;:&quot;Cannon Street (EC4N)<br>
&gt;&gt; (All Directions) at the junction of King William Street - To<br>
&gt;&gt; facilitate a heavy lift in Cannon Street, Cannon Street will be<br>
&gt;&gt; closed. Traffic is slow moving on<br>
&gt;&gt; diversion.&quot;,&quot;coldstart&quot;:true,&quot;foreground&quot;:true,&quot;payload&quot;:{&quot;alert&quot;:&quot;Cannon<br>
&gt;&gt; Street (EC4N) (All Directions) at the junction of King William Street<br>
&gt;&gt; - To facilitate a heavy lift in Cannon Street, Cannon Street will be<br>
&gt;&gt; closed. Traffic is slow moving on diversion.&quot;,&quot;badge&quot;:&quot;-1&quot;}}<br>
&gt;&gt;<br>
&gt;&gt;<br>
</span>&gt;&gt; 1.<br>
<span class="">&gt;&gt;<br>
&gt;&gt; Clicking on the notification in the notification drawer on the iOS<br>
&gt;&gt; device also starts our app up correctly but the notification handler,<br>
&gt;&gt; HandleAeroGearNotification(), is NOT called. The app starts up as<br>
&gt;&gt; normal as<br>
&gt;&gt; if the notification had not been clicked. We would expect the<br>
&gt;&gt; notification<br>
&gt;&gt; handler to be called in iOS as it is in Android.<br>
</span>&gt;&gt; 2.<br>
<span class="">&gt;&gt;<br>
&gt;&gt; All notifications are cleared on both Android and iOS correctly when<br>
&gt;&gt; the app is started up.<br>
</span>&gt;&gt; 3.<br>
<div class="HOEnZb"><div class="h5">&gt;&gt;<br>
&gt;&gt; We define HandleAeroGearNotification as<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;  var aeroGearPushConfig = {<br>
&gt;&gt;      pushServerURL: &quot;<a href="https://push-jambuster.rhcloud.com/ag-push/" rel="noreferrer" target="_blank">https://push-jambuster.rhcloud.com/ag-push/</a>&quot;,<br>
&gt;&gt;      ios: {<br>
&gt;&gt;          variantID: “variantid_obscured”,<br>
&gt;&gt;           variantSecret: “variant_secret_obscured”<br>
&gt;&gt;          } ,<br>
&gt;&gt;       android: {<br>
&gt;&gt;              senderID: &quot;variantid_obscured&quot; ,<br>
&gt;&gt;          variantID: &quot;variant_id_obscured&quot; ,<br>
&gt;&gt;          variantSecret: &quot;variant_secret_obscured&quot;<br>
&gt;&gt;       } ,<br>
&gt;&gt;      sendMetricInfo: true,<br>
&gt;&gt;      alias: alias1<br>
&gt;&gt;  };<br>
&gt;&gt;<br>
&gt;&gt;  function HandleAeroGearNotification(event) {<br>
&gt;&gt;      console.log(“HandleAeroGearNotification: event =&gt; “ +<br>
&gt;&gt; JSON.stringify(event));<br>
&gt;&gt;<br>
&gt;&gt;      // Stuff cut for clarity<br>
&gt;&gt;  }<br>
&gt;&gt;<br>
&gt;&gt;  // Slightly simplified registration event.<br>
&gt;&gt;  push.register(HandleAeroGearNotification , function () {<br>
&gt;&gt;      console.log(“Success”):<br>
&gt;&gt;  } , function () {<br>
&gt;&gt;      console.log(“Failure”);<br>
&gt;&gt;  } , aeroGearPushConfig);<br>
&gt;&gt;<br>
&gt;&gt; We cannot see any reference to this issue in the JIRA database and<br>
&gt;&gt; wondered if it is a bug or not.<br>
&gt;&gt;<br>
&gt;&gt; If its a bug we are happy to raise it accordingly.<br>
&gt;&gt;<br>
&gt;&gt; Please let us know,<br>
&gt;&gt;<br>
&gt;&gt; Thanks<br>
&gt;&gt;<br>
&gt;&gt; Rob<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Aerogear-users mailing list<br>
&gt;&gt; <a href="mailto:Aerogear-users@lists.jboss.org">Aerogear-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Cheers,<br>
&gt;     Erik Jan<br>
&gt; _______________________________________________<br>
&gt; Aerogear-users mailing list<br>
&gt; <a href="mailto:Aerogear-users@lists.jboss.org">Aerogear-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
<br>
_______________________________________________<br>
Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
</div></div></blockquote></div><br></div>