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