[Aerogear-users] Possible bug in Aerogear Push Cordova/iOS implementation but not in the Cordova/Android version
Rob Willett
rwillett at robertwillett.com
Tue Dec 15 09:50:54 EST 2015
Erok,
Thanks for the informative reply. I’ve been out all day doing family
things but I’ll go through this in detail once I get back this
evening.
You are correct re quotes. We use MailMate for our email client and
sometimes strange and wonderful things happen with quotes. The : was a
transcription error as we removed a lot of debug code to make the
example simpler. We do have this stuff working in the foreground and
background :)
What you are describing is that we are doing. However I started to put
together a tiny dummy app last night to test the issue in isolation and
will finish it tonight to see if we get the same results. I agree with
everything you say apart from the bit after killing it, touch a
notification and it being seen as an alert (thats the bit we cannot get
working). I’d be delighted if its our code at fault, embarrassed but
delighted.
From a quick perusal of your code I *think* we are doing exactly what
you are doing.
Let me go through it later and I’ll come back,
Best wishes,
Rob
On 15 Dec 2015, at 10:36, Erik Jan de Wit wrote:
> Hi Rob,
>
> That would be a bug, although I can not reproduce it, to test it this
> is
> what I've done to test it:
>
> $ > cordova create push-test <my bundle id>
> $ > cordova platform add ios
> $ > cordova plugin add aerogear-cordova-push
>
> copy paste your js code into www/js/index.js onDeviceReady, changed
> pushServerUrl and variant info and changed quotes to " (this is your
> email
> client no doubt) and changed : into ; after console.log("Success")
>
>
> Attach Safari debugger and send a message when the app is in the
> foreground
> and get in the console:
>
> HandleAeroGearNotification: event =>
> {"alert":"test","foreground":true,"coldstart":false,"sound":"default","badge":-1,"payload":{}}
>
> I press the home button and send the app to the background send
> another
> message and 'touch' the message to launch the app:
>
> HandleAeroGearNotification: event =>
> {"alert":"background","foreground":false,"coldstart":false,"sound":"default","badge":-1,"payload":{}}
>
> The I kill the app by pressing home twice and swiping over the app to
> remove it send another message and 'touch' 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:
>
> function HandleAeroGearNotification(event) {
> alert("HandleAeroGearNotification: event => " + event.coldstart);
>
> // Stuff cut for clarity
> }
>
> I send another notification 'touch' it to launch the app and see the
> alert
> box display the text:
>
> HandleAeroGearNotification: event => true
>
> Hope this helps
>
>
>
> On Mon, Dec 14, 2015 at 10:20 PM, Rob Willett <
> rob.aerogear at robertwillett.com> wrote:
>
>> Hi,
>>
>> We think we have found a possible bug in the Aerogear Cordova 2.0.4
>> push
>> plugin specifically on the iOS side.
>> Summary
>>
>> 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 (?).
>>
>> 1.
>>
>> We make sure that both apps are NOT started up on each device. We
>> also
>> check they are NOT in the background.
>> 2.
>>
>> 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.
>>
>> 'variants' => [‘variant1’,’variant2’ ],
>> 'message' => {
>> 'additionalData' => { 'Disruption_Id' => '107546',
>> 'EpochTime' => '1450125268'
>> },
>> 'alert' => '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.'
>> },
>> 'alias' => [ ‘alias1’ ],
>> 'ttl' => 600
>> };
>>
>>
>> 1.
>>
>> Both devices show the message, the Android device stacks the message
>> and the iOS device display an individual message. This looks correct.
>> 2.
>>
>> Clicking on the Android stacked message starts up the app and the
>> Javascript notification handler we have defined,
>> HandleAeroGearNotification
>> is called
>>
>> HandleAeroGearNotification: event => {"alert":"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.","coldstart":true,"foreground":true,"payload":{"alert":"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.","badge":"-1"}}
>>
>>
>> 1.
>>
>> 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.
>> 2.
>>
>> All notifications are cleared on both Android and iOS correctly when
>> the app is started up.
>> 3.
>>
>> We define HandleAeroGearNotification as
>>
>>
>> var aeroGearPushConfig = {
>> pushServerURL: "https://push-jambuster.rhcloud.com/ag-push/",
>> ios: {
>> variantID: “variantid_obscured”,
>> variantSecret: “variant_secret_obscured”
>> } ,
>> android: {
>> senderID: "variantid_obscured" ,
>> variantID: "variant_id_obscured" ,
>> variantSecret: "variant_secret_obscured"
>> } ,
>> sendMetricInfo: true,
>> alias: alias1
>> };
>>
>> function HandleAeroGearNotification(event) {
>> console.log(“HandleAeroGearNotification: event => “ +
>> JSON.stringify(event));
>>
>> // Stuff cut for clarity
>> }
>>
>> // Slightly simplified registration event.
>> push.register(HandleAeroGearNotification , function () {
>> console.log(“Success”):
>> } , function () {
>> console.log(“Failure”);
>> } , aeroGearPushConfig);
>>
>> We cannot see any reference to this issue in the JIRA database and
>> wondered if it is a bug or not.
>>
>> If its a bug we are happy to raise it accordingly.
>>
>> Please let us know,
>>
>> Thanks
>>
>> Rob
>>
>> _______________________________________________
>> Aerogear-users mailing list
>> Aerogear-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-users
>>
>>
>
>
> --
> Cheers,
> Erik Jan
> _______________________________________________
> Aerogear-users mailing list
> Aerogear-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-users
More information about the Aerogear-users
mailing list