Update example

This commit is contained in:
Hevin 2017-12-14 17:16:00 +08:00
parent b730924d74
commit 0449935bcb

View File

@ -40,7 +40,7 @@ export class HomePage {
var content; var content;
if (this.devicePlatform == 'Android') { if (this.devicePlatform == 'Android') {
content = event.alert; content = event.alert;
} else { } else {
content = event.aps.alert; content = event.aps.alert;
} }
alert('Receive notification: ' + JSON.stringify(event)); alert('Receive notification: ' + JSON.stringify(event));
@ -50,10 +50,13 @@ export class HomePage {
var content; var content;
if (this.devicePlatform == 'Android') { if (this.devicePlatform == 'Android') {
content = event.alert; content = event.alert;
} else { } else { // iOS
content = event.aps.alert; if (event.aps == undefined) { // 本地通知
content = event.content;
} else { // APNS
content = event.aps.alert;
}
} }
// alert('Open notification: ' + content);
alert('open notification: ' + JSON.stringify(event)); alert('open notification: ' + JSON.stringify(event));
}, false); }, false);
@ -137,7 +140,7 @@ export class HomePage {
if (this.devicePlatform == 'Android') { if (this.devicePlatform == 'Android') {
this.jpush.addLocalNotification(0, 'Hello JPush', 'JPush', 1, 5000); this.jpush.addLocalNotification(0, 'Hello JPush', 'JPush', 1, 5000);
} else { } else {
this.jpush.addLocalNotificationForIOS(5, 'Hello JPush', 1, 'noti1'); this.jpush.addLocalNotificationForIOS(5, 'Hello JPush', 1, 'localNoti1');
} }
} }
} }