mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-22 05:53:04 +08:00
add js event jpush.receiveNotification
This commit is contained in:
parent
7d489c7f20
commit
aae9e8314a
@ -86,6 +86,9 @@
|
|||||||
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
|
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
|
||||||
// Required
|
// Required
|
||||||
[APService handleRemoteNotification:userInfo];
|
[APService handleRemoteNotification:userInfo];
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:kJPushPluginReceiveNotification
|
||||||
|
object:userInfo];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
###Android 手工安装###
|
###Android 手工安装###
|
||||||
|
@ -37,6 +37,16 @@
|
|||||||
console.log(exception)
|
console.log(exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var onReceiveNotification = function(event){
|
||||||
|
try{
|
||||||
|
var alert = event.aps.alert;
|
||||||
|
console.log("JPushPlugin:onReceiveNotification key aps.alert:"+aps);
|
||||||
|
}
|
||||||
|
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)
|
||||||
@ -102,10 +112,11 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
document.addEventListener("jpush.receiveNotification", onReceiveNotification, false);
|
||||||
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);
|
document.addEventListener("jpush.openNotification", onOpenNotification, false);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#import <Cordova/CDV.h>
|
#import <Cordova/CDV.h>
|
||||||
|
|
||||||
|
#define kJPushPluginReceiveNotification @"JPushPluginReceiveNofication"
|
||||||
|
|
||||||
@interface JPushPlugin : CDVPlugin{
|
@interface JPushPlugin : CDVPlugin{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
name:kJPFNetworkDidReceiveMessageNotification
|
name:kJPFNetworkDidReceiveMessageNotification
|
||||||
object:nil];
|
object:nil];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user