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
};
```
3. Both devices show the message, the Android device stacks the message
and the iOS device display an individual message. This looks correct.
4. 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"}}
```
5. 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.
6. All notifications are cleared on both Android and iOS correctly when
the app is started up.
6. 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