mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-01-31 22:42:51 +08:00
update iOS docs
This commit is contained in:
parent
3f1fa1e7ba
commit
9c103753e6
@ -143,7 +143,7 @@ window.JPush.getRegistrationID(function(data) {
|
||||
|
||||
#### event - jpush.openNotification
|
||||
|
||||
点击通知启动或唤醒应用程序时会触发该事件
|
||||
点击通知(包括 localNotification 和 remoteNotification)启动或唤醒应用程序时会触发该事件
|
||||
|
||||
#### 代码示例
|
||||
|
||||
@ -433,6 +433,34 @@ window.JPush.clearAllLocalNotifications()
|
||||
|
||||
监听 `jpush.receiveLocalNotification` 事件获取,「App 在后台时点击通知横幅」或「App 在前台时收到」均会触发该事件。
|
||||
|
||||
#### 代码示例
|
||||
|
||||
- 在你需要接收通知的的 js 文件中加入:
|
||||
|
||||
```js
|
||||
document.addEventListener("jpush.receiveLocalNotification", onLocalNotification, false)
|
||||
```
|
||||
|
||||
- onLocalNotification 需要这样写:
|
||||
|
||||
```js
|
||||
var onLocalNotification = function(event) {
|
||||
alert("receive Local Notification:" + JSON.stringify(event))
|
||||
}
|
||||
```
|
||||
|
||||
- event 举例
|
||||
|
||||
```json
|
||||
{
|
||||
badge = 1;
|
||||
content = "Hello JPush";
|
||||
extras = {
|
||||
"__JPUSHNotificationKey" = notificationIdentify_1;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### iOS 10 收到本地通知
|
||||
|
||||
监听 [jpush.receiveNotification](#前台收到推送)、[jpush.openNotification](点击推送通知),获取推送内容后,通过获取到的 `__JPUSHNotificationKey` 字段([本地通知](#本地通知) 设置的 `notificationID`)来判断是本地通知,并处理。
|
||||
|
Loading…
Reference in New Issue
Block a user