【发布时间】:2015-09-16 12:56:48
【问题描述】:
我目前有一个 phonegap 应用程序,我在其中使用 pushPlugin 和警报框来显示传入的推送通知。但是,我希望这些消息出现在设备状态栏中。我需要做些什么才能让它们出现在那里吗?也许一些额外的配置?谢谢。
这是使用警告框的那段代码:
case 'message':
// if this flag is set, this notification happened while we were in the foreground.
// you might want to play a sound to get the user's attention, throw up a dialog, etc.
if (event.foreground) {
console.log('INLINE NOTIFICATION');
//var my_media = new Media("/android_asset/www/" + event.soundname);
//my_media.play();
} else {
if (event.coldstart) {
console.log('COLDSTART NOTIFICATION');
} else {
console.log('BACKGROUND NOTIFICATION');
}
}
navigator.notification.alert(event.payload.message);//alert notification
console.log('MESSAGE -> MSG: ' + event.payload.message);
//Only works for GCM
console.log('MESSAGE -> MSGCNT: ' + event.payload.msgcnt);
//Only works on Amazon Fire OS
console.log('MESSAGE -> TIME: ' + event.payload.timeStamp);
break;
【问题讨论】:
标签: android cordova push-notification phonegap-plugins