$.plusReady(function() {
// 监听在线消息事件
plus.push.addEventListener("receive", function (msg) {
if (msg.aps) { // Apple APNS message
//接收到在线APNS消息
PUSH_EVENT.aps(msg);
} else {
PUSH_EVENT.default(msg);
}
});
plus.push.addEventListener("click", function (msg) {
if (msg.aps) { // Apple APNS message
//接收到在线APNS消息
PUSH_EVENT.aps(msg);
} else {
PUSH_EVENT.default(msg);
}
});
plus.push.setAutoNotification(false); //程序运行时设置消息中心不显示消息,recive接收
document.addEventListener("pause", function() {
plus.push.setAutoNotification(true); //切换到后台时设置消息中心显示消息,click接收
console.log("pause");
}, false);
document.addEventListener("resume", function() {
plus.push.setAutoNotification(false); //切换到前台时设置消息中心不显示消息,recive接收
console.log("resume");
}, false);
});
评论已关闭