<div dir="ltr">Hi Rob,<div><br></div><div>That would be a bug, although I can not reproduce it, to test it this is what I&#39;ve done to test it:</div><div><br></div><div><div class="" style="margin-bottom:16px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-top:0px!important"><pre style="overflow:auto;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;background-color:rgb(247,247,247)">$ <span class="" style="color:rgb(167,29,93)">&gt;</span> cordova create push-test <span class="" style="color:rgb(167,29,93)">&lt;</span>my bundle id<span class="" style="color:rgb(167,29,93)">&gt;</span>
$ <span class="" style="color:rgb(167,29,93)">&gt;</span> cordova platform add ios
$ <span class="" style="color:rgb(167,29,93)">&gt;</span> cordova plugin add aerogear-cordova-push</pre></div><p style="margin-top:0px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-bottom:0px!important">copy paste your js code into www/js/index.js onDeviceReady, changed pushServerUrl and variant info and changed quotes to &quot; (this is your email client no doubt) and changed : into ; after console.log(&quot;Success&quot;)</p><p style="margin-top:0px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-bottom:0px!important"><br></p><p style="margin-top:0px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-bottom:0px!important">Attach Safari debugger and send a message when the app is in the foreground and get in the console:</p><pre style="overflow:auto;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)">HandleAeroGearNotification: event =&gt; {<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>alert<span class="">&quot;</span></span>:<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>test<span class="">&quot;</span></span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>foreground<span class="">&quot;</span></span>:<span class="" style="color:rgb(0,134,179)">true</span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>coldstart<span class="">&quot;</span></span>:<span class="" style="color:rgb(0,134,179)">false</span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>sound<span class="">&quot;</span></span>:<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>default<span class="">&quot;</span></span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>badge<span class="">&quot;</span></span>:<span class="" style="color:rgb(0,134,179)">-1</span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>payload<span class="">&quot;</span></span>:{}}</pre><p style="margin-top:0px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-bottom:0px!important">I press the home button and send the app to the background send another message and &#39;touch&#39; the message to launch the app:</p><pre style="overflow:auto;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)">HandleAeroGearNotification: event =&gt; {<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>alert<span class="">&quot;</span></span>:<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>background<span class="">&quot;</span></span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>foreground<span class="">&quot;</span></span>:<span class="" style="color:rgb(0,134,179)">false</span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>coldstart<span class="">&quot;</span></span>:<span class="" style="color:rgb(0,134,179)">false</span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>sound<span class="">&quot;</span></span>:<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>default<span class="">&quot;</span></span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>badge<span class="">&quot;</span></span>:<span class="" style="color:rgb(0,134,179)">-1</span>,<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>payload<span class="">&quot;</span></span>:{}}</pre><p style="margin-top:0px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-bottom:0px!important">The I kill the app by pressing home twice and swiping over the app to remove it send another message and &#39;touch&#39; it to launch the app. This kills my safari debugger so no way to see the console log, but in this case coldstart should be true. To test this better changed the code to alert instead of console:</p><pre style="overflow:auto;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)">  <span class="" style="color:rgb(167,29,93)">function</span> <span class="" style="color:rgb(121,93,163)">HandleAeroGearNotification</span>(<span class="">event</span>) {
      <span class="" style="color:rgb(0,134,179)">alert</span>(<span class="" style="color:rgb(24,54,145)"><span class="">&quot;</span>HandleAeroGearNotification: event =&gt; <span class="">&quot;</span></span> <span class="" style="color:rgb(167,29,93)">+</span> <span class="">event</span>.<span class="">coldstart</span>);

      <span class="" style="color:rgb(150,152,150)">// Stuff cut for clarity</span>
  }</pre><p style="margin-top:0px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-bottom:0px!important">I send another notification &#39;touch&#39; it to launch the app and see the alert box display the text:</p><pre style="overflow:auto;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)">HandleAeroGearNotification: event =<span class="" style="color:rgb(167,29,93)">&gt;</span> <span class="" style="color:rgb(0,134,179)">true</span></pre><p style="margin-top:0px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-bottom:0px!important">Hope this helps</p><p style="margin-top:0px;color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px;margin-bottom:0px!important"><br></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 14, 2015 at 10:20 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"><div>
<p dir="auto">Hi,</p>

<p dir="auto">We think we have found a possible bug in the Aerogear Cordova 2.0.4 push plugin specifically on the iOS side. </p>

<h3>Summary</h3>

<p dir="auto">We have two versions of our app, an Android and an IOS version. Both use the latest Cordova push plugin 2.0.4. They also both have the latest Cordova platforms, android 4.1.1, ios 3.9.2. Both the iOS and Android versions are compiled at the same time. We are running cordova 5.3.3 with Ionic 1.7.8 (?).</p>

<ol>
<li value="1"><p dir="auto">We make sure that both apps are NOT started up on each device. We also check they are NOT in the background.</p></li>
<li value="2"><p dir="auto">We send the same simple notification to each device. This notification config is as below, we have anonymised the variants and alias in this JSON structure, though we can report that the UPS server sends the data correctly. We use the additionalData flag to provide the information necessary to decide which notification has been clicked in the notification drawer. </p></li>
</ol>

<pre><code>&#39;variants&#39; =&gt; [‘variant1’,’variant2’ ],
&#39;message&#39; =&gt; {
    &#39;additionalData&#39; =&gt; { &#39;Disruption_Id&#39; =&gt; &#39;107546&#39;,
                         &#39;EpochTime&#39; =&gt; &#39;1450125268&#39;
                        },
    &#39;alert&#39; =&gt; &#39;Cannon Street (EC4N) (All Directions) at the junction of King William Street - To facilitate a heavy lift in Cannon Street, Cannon Street will be closed. Traffic is slow moving on diversion.&#39; },
    &#39;alias&#39; =&gt; [ ‘alias1’ ],
    &#39;ttl&#39; =&gt; 600
};
</code></pre>

<ol>
<li value="3"><p dir="auto">Both devices show the message, the Android device stacks the message and the iOS device display an individual message. This looks correct.</p></li>
<li value="4"><p dir="auto">Clicking on the Android stacked message starts up the app and the Javascript notification handler we have defined, HandleAeroGearNotification is called </p></li>
</ol>

<pre><code>HandleAeroGearNotification: event =&gt; {&quot;alert&quot;:&quot;Cannon Street (EC4N) (All Directions) at the junction of King William Street - To facilitate a heavy lift in Cannon Street, Cannon Street will be closed. Traffic is slow moving on diversion.&quot;,&quot;coldstart&quot;:true,&quot;foreground&quot;:true,&quot;payload&quot;:{&quot;alert&quot;:&quot;Cannon Street (EC4N) (All Directions) at the junction of King William Street - To facilitate a heavy lift in Cannon Street, Cannon Street will be closed. Traffic is slow moving on diversion.&quot;,&quot;badge&quot;:&quot;-1&quot;}}
</code></pre>

<ol>
<li value="5"><p dir="auto">Clicking on the notification in the notification drawer on the iOS device also starts our app up correctly but the notification handler, HandleAeroGearNotification(), is NOT called. The app starts up as normal as if the notification had not been clicked. We would expect the notification handler to be called in iOS as it is in Android. </p></li>
<li value="6"><p dir="auto">All notifications are cleared on both Android and iOS correctly when the app is started up.</p></li>
<li value="6"><p dir="auto">We define HandleAeroGearNotification as</p></li>
</ol>

<pre><code>
    var aeroGearPushConfig = {
        pushServerURL: &quot;<a href="https://push-jambuster.rhcloud.com/ag-push/" target="_blank">https://push-jambuster.rhcloud.com/ag-push/</a>&quot;,
        ios: {
            variantID: “variantid_obscured”,
             variantSecret: “variant_secret_obscured”
            } ,
         android: {
                senderID: &quot;variantid_obscured&quot; ,
            variantID: &quot;variant_id_obscured&quot; ,
            variantSecret: &quot;variant_secret_obscured&quot;
         } ,
        sendMetricInfo: true,
        alias: alias1
    };

    function HandleAeroGearNotification(event) {
        console.log(“HandleAeroGearNotification: event =&gt; “ + JSON.stringify(event));

        // Stuff cut for clarity
    }

    // Slightly simplified registration event.
    push.register(HandleAeroGearNotification , function () { 
        console.log(“Success”):
    } , function () {
        console.log(“Failure”);
    } , aeroGearPushConfig);
</code></pre>

<p dir="auto">We cannot see any reference to this issue in the JIRA database and wondered if it is a bug or not.</p>

<p dir="auto">If its a bug we are happy to raise it accordingly.</p>

<p dir="auto">Please let us know,</p>

<p dir="auto">Thanks</p><span class="HOEnZb"><font color="#888888">

<p dir="auto">Rob</p>

</font></span></div><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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Cheers,<div>       Erik Jan</div></div></div>
</div>