mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-22 14:02:55 +08:00
增加了打开通知的event回调
This commit is contained in:
parent
e945bcf53d
commit
27ebdd6809
@ -26,6 +26,17 @@
|
|||||||
console.log(exception)
|
console.log(exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var onOpenNotification = function(event){
|
||||||
|
try{
|
||||||
|
var alert = event.alert;
|
||||||
|
var extras = event.extras;
|
||||||
|
console.log(alert);
|
||||||
|
console.log(extras);
|
||||||
|
}
|
||||||
|
catch(exeption){
|
||||||
|
console.log(exception)
|
||||||
|
}
|
||||||
|
}
|
||||||
var onGetRegistradionID = function(data) {
|
var onGetRegistradionID = function(data) {
|
||||||
try{
|
try{
|
||||||
console.log("JPushPlugin:registrationID is "+data)
|
console.log("JPushPlugin:registrationID is "+data)
|
||||||
@ -93,6 +104,8 @@
|
|||||||
}
|
}
|
||||||
document.addEventListener("jpush.setTagsWithAlias", onTagsWithAlias, false);
|
document.addEventListener("jpush.setTagsWithAlias", onTagsWithAlias, false);
|
||||||
document.addEventListener("deviceready", onDeviceReady, false);
|
document.addEventListener("deviceready", onDeviceReady, false);
|
||||||
|
document.addEventListener("jpush.openNotification", onOpenNotification, false);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -144,6 +144,11 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
data.toString());
|
data.toString());
|
||||||
try {
|
try {
|
||||||
instance.webView.sendJavascript(js);
|
instance.webView.sendJavascript(js);
|
||||||
|
|
||||||
|
String jsEvent=String
|
||||||
|
.format("cordova.fireDocumentEvent('jpush.openNotification',%s)",
|
||||||
|
data.toString());
|
||||||
|
instance.webView.sendJavascript(jsEvent);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user