document.addEventListener("plusready", function() {
message = document.getElementById("message");
var vInfo = plus.push.getClientInfo();
var vInfoData = JSON.stringify(vInfo);
console.log(vInfoData);
// 監聽點擊消息事件
plus.push.addEventListener("click", function(msg) {
switch(msg.payload) {
case "LocalMSG":
outSet("點擊本地建立消息啓動:");
break;
default:
outSet("點擊離線推送消息啓動:");
break;
}
// 提示點擊的內容
plus.ui.alert(msg.content);
// 處理其它數據
logoutPushMsg(msg);
}, false);
// 監聽在線消息事件
plus.push.addEventListener("receive", function(msg) {
if(msg.aps) { // Apple APNS message
outSet("接收到在線APNS消息:");
} else {
outSet("接收到在線透傳消息:");
}
logoutPushMsg(msg);
}, false);
}, false);ui
效果以下:事件