【发布时间】:2014-11-15 15:50:47
【问题描述】:
我已经在cordova中使用(https://github.com/phonegap-build/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 ( e.foreground )
{
// if this flag is set, this notification happened while we were in the foreground.
//this is not working
if(e.foreground){
var myMedia = new Media("/assets/www/img/beep.mp3");
my_media.play();
}else{
// otherwise we were launched because the user touched a notification in the notification tray.
}
break;
【问题讨论】:
标签: javascript android cordova push-notification ionic-framework