From 0449935bcb577e81222550cc817e68bdad4b64d2 Mon Sep 17 00:00:00 2001 From: Hevin Date: Thu, 14 Dec 2017 17:16:00 +0800 Subject: [PATCH] Update example --- ionic/example/src/pages/home/home.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ionic/example/src/pages/home/home.ts b/ionic/example/src/pages/home/home.ts index 22b1577..dba5e08 100644 --- a/ionic/example/src/pages/home/home.ts +++ b/ionic/example/src/pages/home/home.ts @@ -40,7 +40,7 @@ export class HomePage { var content; if (this.devicePlatform == 'Android') { content = event.alert; - } else { + } else { content = event.aps.alert; } alert('Receive notification: ' + JSON.stringify(event)); @@ -50,10 +50,13 @@ export class HomePage { var content; if (this.devicePlatform == 'Android') { content = event.alert; - } else { - content = event.aps.alert; + } else { // iOS + if (event.aps == undefined) { // 本地通知 + content = event.content; + } else { // APNS + content = event.aps.alert; + } } - // alert('Open notification: ' + content); alert('open notification: ' + JSON.stringify(event)); }, false); @@ -137,7 +140,7 @@ export class HomePage { if (this.devicePlatform == 'Android') { this.jpush.addLocalNotification(0, 'Hello JPush', 'JPush', 1, 5000); } else { - this.jpush.addLocalNotificationForIOS(5, 'Hello JPush', 1, 'noti1'); + this.jpush.addLocalNotificationForIOS(5, 'Hello JPush', 1, 'localNoti1'); } } }