mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-22 05:53:04 +08:00
add 'jpush.openNotificaiton'event in iOS ducoment
This commit is contained in:
parent
a049e2e62d
commit
2dbd0cb248
58
README.md
58
README.md
@ -569,24 +569,58 @@ iOS
|
|||||||
|
|
||||||
- 在你需要接收通知的的js文件中加入:
|
- 在你需要接收通知的的js文件中加入:
|
||||||
|
|
||||||
document.addEventListener("jpush.receiveNotification", onNotification, false);
|
document.addEventListener("jpush.receiveNotification", onReceiveNotification, false);
|
||||||
|
|
||||||
- onOpenNotification需要这样写:
|
- onOpenNotification需要这样写:
|
||||||
|
|
||||||
var onNotification = function(event){
|
var onReceiveNotification = function(event){
|
||||||
try{
|
try{
|
||||||
var alert = event.alert;
|
var alert = event.aps.alert;
|
||||||
var extras = event.extras;
|
console.log("JPushPlugin:onReceiveNotification key aps.alert:"+alert);
|
||||||
console.log(alert);
|
}
|
||||||
//console.log(extras);
|
catch(exeption){
|
||||||
}
|
console.log(exception)
|
||||||
catch(exeption){
|
}
|
||||||
console.log(exception)
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#####返回值
|
#####返回值
|
||||||
无
|
无
|
||||||
|
|
||||||
|
|
||||||
|
#### event - jpush.openNotification
|
||||||
|
|
||||||
|
当iOS收到的通知时会触发这个事件
|
||||||
|
|
||||||
|
##### 事件定义
|
||||||
|
|
||||||
|
cordova.fireDocumentEvent('jpush.openNotification',json)
|
||||||
|
|
||||||
|
#####平台
|
||||||
|
iOS
|
||||||
|
|
||||||
|
#####使用说明
|
||||||
|
|
||||||
|
- 在你需要接收通知的的js文件中加入:
|
||||||
|
|
||||||
|
document.addEventListener("jpush.openNotification", onOpenNotification, false);
|
||||||
|
|
||||||
|
- onOpenNotification需要这样写:
|
||||||
|
|
||||||
|
var onOpenNotification = function(event){
|
||||||
|
try{
|
||||||
|
|
||||||
|
var alert = event.aps.alert;
|
||||||
|
console.log("JPushPlugin:onPpenNotification key aps.alert:"+alert);
|
||||||
|
}
|
||||||
|
catch(exception){
|
||||||
|
console.log("JPushPlugin:onPpenNotification"+exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#### API - setApplicationIconBadgeNumber
|
#### API - setApplicationIconBadgeNumber
|
||||||
|
|
||||||
设置iOS的角标,当设置badge=0时为清除角标
|
设置iOS的角标,当设置badge=0时为清除角标
|
||||||
|
Loading…
Reference in New Issue
Block a user