Add event listener for jpush.receiveMessage

Add event listener for jpush.receiveMessage in ionic example
This commit is contained in:
happy2discover 2018-02-11 19:31:44 +08:00 committed by GitHub
parent 54b653e442
commit 65ea3c935d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,16 @@ export class HomePage {
alert('Receive notification: ' + JSON.stringify(event));
}, false);
document.addEventListener('jpush.receiveMessage', (event: any) => {
var content;
if (this.devicePlatform == 'Android') {
content = event.message;
} else {
content = event.content;
}
alert('Receive message: ' + JSON.stringify(event));
}, false);
document.addEventListener('jpush.openNotification', (event: any) => {
var content;
if (this.devicePlatform == 'Android') {