Javascript 当屏幕锁定时,PhoneGap推送通知在通知栏中显示消息
这是我在Android应用程序中设置推送通知的代码,它工作得非常好 我唯一不想显示的是在通知栏上收到的推送消息,当我的屏幕被锁定或应用程序未打开时,该消息会保留在通知栏上(但如果应用程序在主屏幕上打开,则不会在通知栏中显示任何内容)Javascript 当屏幕锁定时,PhoneGap推送通知在通知栏中显示消息,javascript,google-cloud-messaging,phonegap-pushplugin,Javascript,Google Cloud Messaging,Phonegap Pushplugin,这是我在Android应用程序中设置推送通知的代码,它工作得非常好 我唯一不想显示的是在通知栏上收到的推送消息,当我的屏幕被锁定或应用程序未打开时,该消息会保留在通知栏上(但如果应用程序在主屏幕上打开,则不会在通知栏中显示任何内容) 有解决办法吗?没有解决办法吗?没有解决办法吗???? onNotificationGCM: function (e) { // alert('onNotificationGCM'); switch( e.event ) {
有解决办法吗?没有解决办法吗?没有解决办法吗????
onNotificationGCM: function (e) {
// alert('onNotificationGCM');
switch( e.event )
{
case 'registered':
if ( e.regid.length > 0 )
{
console.log("Regid " + e.regid);
var regID=e.regid;
//Call postGCMRegistration inthe hosLib.js Class to send RegID to Server
postGCMRegistration(regID);
// alert('registration id = '+regID);
}
break;
case 'message':
if (e.foreground) {
// this is the actual push notification. its format depends on the data model from the push server
if (e.message == "ignitionON") {
// alert("ignitionON");
ignitionON();
}
if (e.message == "movementON") {
// alert("movementON");
MovementStarted();
}
if (e.message == "ignitionOFF") {
// alert("ignitionOFF");
ignitionOFF();
}
}
//alert('message = '+e.message+' msgcnt = '+e.msgcnt);
break;
case 'error':
//alert('GCM error = '+e.msg);
break;
default:
// alert('An unknown GCM event has occurred');
break;
}
},
};