mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-21 21:43:02 +08:00
android 更新到 3.7.4
This commit is contained in:
parent
a26822b894
commit
e140dc3b77
@ -49,6 +49,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
var badgeNumb = 0;
|
||||
var onOpenNotification = function(event) {
|
||||
try {
|
||||
var alertContent;
|
||||
@ -57,6 +58,11 @@
|
||||
} else {
|
||||
alertContent = event.aps.alert;
|
||||
}
|
||||
|
||||
badgeNumb = badgeNumb - 1;
|
||||
badgeNumb = badgeNumb<=0 ? 0 : badgeNumb;
|
||||
window.JPush.setBadgeNumber(badgeNumb);
|
||||
|
||||
alert("open Notification:" + alertContent);
|
||||
} catch (exception) {
|
||||
console.log("JPushPlugin:onOpenNotification" + exception);
|
||||
@ -72,6 +78,9 @@
|
||||
alertContent = event.aps.alert;
|
||||
}
|
||||
$("#notificationResult").html(alertContent);
|
||||
|
||||
badgeNumb = badgeNumb + 1;
|
||||
window.JPush.setBadgeNumber(badgeNumb);
|
||||
} catch (exception) {
|
||||
console.log(exception)
|
||||
}
|
||||
@ -86,11 +95,24 @@
|
||||
message = event.content;
|
||||
}
|
||||
$("#messageResult").html(message);
|
||||
|
||||
badgeNumb = badgeNumb + 1;
|
||||
window.JPush.setBadgeNumber(badgeNumb);
|
||||
} catch (exception) {
|
||||
console.log("JPushPlugin:onReceiveMessage-->" + exception);
|
||||
}
|
||||
};
|
||||
|
||||
var onResume = function(event){
|
||||
try {
|
||||
badgeNumb = 0
|
||||
window.JPush.setBadgeNumber(0);
|
||||
|
||||
} catch (exception) {
|
||||
console.log("onResume-->" + exception);
|
||||
}
|
||||
}
|
||||
|
||||
var initiateUI = function() {
|
||||
try {
|
||||
window.JPush.init();
|
||||
@ -184,6 +206,7 @@
|
||||
document.addEventListener("jpush.openNotification", onOpenNotification, false);
|
||||
document.addEventListener("jpush.receiveNotification", onReceiveNotification, false);
|
||||
document.addEventListener("jpush.receiveMessage", onReceiveMessage, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user