diff --git a/doc/Android_detail_api.md b/doc/Android_detail_api.md
index 13c9611..c478e31 100644
--- a/doc/Android_detail_api.md
+++ b/doc/Android_detail_api.md
@@ -13,7 +13,6 @@
- [通知栏样式定制](#通知栏样式定制)
- [设置保留最近通知条数](#设置保留最近通知条数)
- [本地通知](#本地通知)
-- [富媒体页面 JavaScript 回调 API](#富媒体页面-javascript-回调-api)
## 注册成功事件
### jpush.receiveRegistrationId
@@ -21,36 +20,37 @@
就会触发这个事件(注意只有第一次会触发该事件,之后如果想要取到 registrationId,可以直接调用 *getRegistrationID* 方法)。
#### 代码示例
-```Javascript
+
+```js
document.addEventListener('jpush.receiveRegistrationId', function (event) {
- console.log(event.registrationId)
+ console.log(event.registrationId)
}, false)
```
## 接收通知时获得通知的内容
- 内容:
- window.plugins.jPushPlugin.receiveNotification.alert
+ window.JPush.receiveNotification.alert
- 标题:
- window.plugins.jPushPlugin.receiveNotification.title
+ window.JPush.receiveNotification.title
- 附加字段:
- window.plugins.jPushPlugin.receiveNotification.extras.yourKey
+ window.JPush.receiveNotification.extras.yourKey
## 打开通知时获得通知的内容
- 内容:
- window.plugins.jPushPlugin.openNotification.alert
+ window.JPush.openNotification.alert
- 标题:
- window.plugins.jPushPlugin.openNotification.title
+ window.JPush.openNotification.title
- 附加字段
- window.plugins.jPushPlugin.openNotification.extras.yourKey
+ window.JPush.openNotification.extras.yourKey
## 收到自定义消息时获取消息的内容
- 内容:
- window.plugins.jPushPlugin.receiveMessage.message
+ window.JPush.receiveMessage.message
- 附加字段:
- window.plugins.jPushPlugin.receiveMessage.extras.yourKey
+ window.JPush.receiveMessage.extras.yourKey
## 获取集成日志(同时适用于 iOS)
@@ -60,88 +60,15 @@ document.addEventListener('jpush.receiveRegistrationId', function (event) {
#### 接口定义
- window.plugins.jPushPlugin.setDebugMode(mode)
+```js
+window.JPush.setDebugMode(mode)
+```
#### 参数说明
- mode:
- - true 显示集成日志。
- - false 不显示集成日志。
-
-## 接收消息和点击通知事件
-### API - receiveMessageInAndroidCallback
-
-用于 Android 收到应用内消息的回调函数(请注意和通知的区别),该函数不需要主动调用。
-
-#### 接口定义
-
- window.plugins.jPushPlugin.receiveMessageInAndroidCallback(data)
-
-#### 参数说明
-
-- data: 接收到的 js 字符串,包含的 key:value 请进入该函数体查看。
-
-
-### API - openNotificationInAndroidCallback
-
-当点击 Android 手机的通知栏进入应用程序时,会调用这个函数,这个函数不需要主动调用,是作为回调函数来用的。
-
-#### 接口定义
-
- window.plugins.jPushPlugin.openNotificationInAndroidCallback(data)
-
-#### 参数说明
-
-- data: js 字符串。
-
-## 统计分析
-
-### API - onResume / onPause
-
-这是一个 Android Local API,不是 js 的 API,请注意。
-本 API 用于“用户使用时长”,“活跃用户”,“用户打开次数”的统计,并上报到服务器,在 Portal 上展示给开发者。
-
-#### 接口定义
-
- public static void onResume(final Activity activity)
- public static void onPause(final Activity activity)
-
-#### 参数说明
-
- - Activity: 当前所在的 Activity。
-
-#### 调用说明
-
-应在所有的 Activity 的 onResume / onPause 方法里调用。
-
-#### 代码示例
-
- @Override
- protected void onResume() {
- super.onResume();
- JPushInterface.onResume(this);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- JPushInterface.onPause(this);
- }
-
-### API - setStatisticsOpen
-
-用于在 js 中控制是否打开应用的统计分析功能,但如果已经添加了上面的 onResume / onPause 方法,
-就不能再通过这个方法来控制统计分析功能了。
-
-#### 接口定义
-
- window.plugins.jPushPlugin.setStatisticsOpen(boolean)
-
-#### 参数说明
-
-- boolean:
- - true: 打开统计分析功能。
- - false: 关闭统计分析功能。
+ - true 显示集成日志。
+ - false 不显示集成日志。
### API - reportNotificationOpened
@@ -149,13 +76,14 @@ document.addEventListener('jpush.receiveRegistrationId', function (event) {
#### 接口定义
- window.plugins.jPushPlugin.reportNotificationOpened(msgID)
+```js
+window.JPush.reportNotificationOpened(msgID)
+```
#### 参数说明
- msgID: 收到的通知或者自定义消息的 id。
-
## 清除通知
### API - clearAllNotification
@@ -166,34 +94,44 @@ document.addEventListener('jpush.receiveRegistrationId', function (event) {
#### 接口定义
- window.plugins.jPushPlugin.clearAllNotification()
+```js
+window.JPush.clearAllNotification()
+```
### API - clearNotificationById
根据通知 Id 清除通知(包括本地通知)。
#### 接口定义
- window.plugins.jPushPlugin.clearNotificationById(notificationId)
+```js
+window.JPush.clearNotificationById(notificationId)
+```
#### 参数说明
- notificationId:int,通知的 id。
#### 代码示例
- window.plugins.jPushPlugin.clearNotificationById(1)
+```js
+window.JPush.clearNotificationById(1)
+```
## 设置允许推送时间
### API - setPushTime
+
默认情况下用户在任何时间都允许推送。即任何时候有推送下来,客户端都会收到,并展示。
开发者可以调用此 API 来设置允许推送的时间。
如果不在该时间段内收到消息,当前的行为是:推送到的通知会被扔掉。
#### 接口定义
- window.plugins.jPushPlugin.setPushTime(days, startHour, endHour)
+```js
+window.JPush.setPushTime(days, startHour, endHour)
+```
#### 参数说明
+
- days: 数组,0 表示星期天,1 表示星期一,以此类推(7天制,数组中值的范围为 0 到 6 )。
数组的值为 null, 表示任何时间都可以收到消息和通知,数组的 size 为 0,则表示任何时间都收不到消息和通知。
- startHour: 整形,允许推送的开始时间 (24 小时制:startHour 的范围为 0 到 23)。
@@ -208,7 +146,9 @@ document.addEventListener('jpush.receiveRegistrationId', function (event) {
#### 接口定义
- window.plugins.jPushPlugin.setSilenceTime(startHour, startMinute, endHour, endMinute)
+```js
+window.JPush.setSilenceTime(startHour, startMinute, endHour, endMinute)
+```
#### 参数说明
@@ -217,7 +157,6 @@ document.addEventListener('jpush.receiveRegistrationId', function (event) {
- endHour: 整形,静音时段的结束时间 - 小时 (24小时制,范围:0~23 )。
- endMinute: 整形,静音时段的结束时间 - 分钟(范围:0~59 )。
-
## 通知栏样式定制
### API - setBasicPushNotificationBuilder, setCustomPushNotificationBuilder
@@ -238,9 +177,10 @@ JPush SDK 提供了 2 个用于定制通知栏样式的构建类:
#### 接口定义
- window.plugins.jPushPlugin.setBasicPushNotificationBuilder()
- window.plugins.jPushPlugin.setCustomPushNotificationBuilder()
-
+```js
+window.JPush.setBasicPushNotificationBuilder()
+window.JPush.setCustomPushNotificationBuilder()
+```
## 设置保留最近通知条数
@@ -252,13 +192,14 @@ JPush SDK 提供了 2 个用于定制通知栏样式的构建类:
#### 接口定义
- window.plugins.jPushPlugin.setLatestNotificationNum(num)
+```js
+window.JPush.setLatestNotificationNum(num)
+```
#### 参数说明
- num: 保存的条数。
-
## 本地通知
### API - addLocalNotification, removeLocalNotification, clearLocalNotifications
本地通知 API 不依赖于网络,无网条件下依旧可以触发。
@@ -271,77 +212,17 @@ JPush SDK 提供了 2 个用于定制通知栏样式的构建类:
#### 接口定义
- window.plugins.jPushPlugin.addLocalNotification(builderId, content, title,
- notificaitonID, broadcastTime, extras)
- window.plugins.jPushPlugin.removeLocalNotification(notificationID)
- window.plugins.jPushPlugin.clearLocalNotifications() // 同时适用于 iOS
+```js
+window.JPush.addLocalNotification(builderId, content, title, notificationID, broadcastTime, extras)
+window.JPush.removeLocalNotification(notificationID)
+window.JPush.clearLocalNotifications() // 同时适用于 iOS
+```
#### 参数说明
- builderId: 设置本地通知样式。
- content: 设置本地通知的 content。
- title: 设置本地通知的 title。
-- notificaitonID: 设置本地通知的 ID(不要为 0)。
+- notificationID: 设置本地通知的 ID(不要为 0)。
- broadcastTime: 设置本地通知触发时间,为距离当前时间的数值,单位是毫秒。
-- extras: 设置额外的数据信息 extras 为 json 字符串。
-
-
-## 富媒体页面 JavaScript 回调 API
-富媒体推送通知时,用户可以用自定义的Javascript 函数来控制页面,如关闭当前页面,点击按钮跳转到指定的 Activity,通知应用程序做一些指定的动作等。
-
-此 API 提供的回调函数包括:关闭当前页面、打开应用的主 Activity、根据 Activity 名字打开对应的 Activity、以广播的形式传递页面参数到应用程序等功能。
-
-### API - 关闭当前页面
-
- JPushWeb.close(); // 在富文本 HTML 页面中调用后会关闭当前页面。
-
-### API - 打开主 Activity
-
- JPushWeb.startMainActivity(String params);
-
-在HTML中调用此函数后,会打开程序的主Activity, 并在对应的 Intent 传入参数 ”params“ ,Key 为 JPushInterface.EXTRA_EXTRA。
-
-对应 Activity 获取 params 示例代码:
-
- Intent intent = getIntent();
- if (null != intent ) {
- String params = intent.getStringExtra(JPushInterface.EXTRA_EXTRA);
- }
-
-### API - 触发应用中的操作
-
- JPushWeb.triggerNativeAction(String params);
-
-调用了该方法后需要在 MyReceiver.java 中实现后面的业务逻辑:
-
- if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
- Log.d(TAG, "用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
- //在这里根据 JPushInterface.EXTRA_EXTRA 的内容触发客户端动作,比如打开新的Activity 、打开一个网页等。
- }
-
-#### 代码示例
-
-
-
-
- JPush Webview Test
-
-
-
-
-
-
-
-
-
-
+- extras: 设置额外的数据信息 extras 为 json 字符串。
\ No newline at end of file
diff --git a/doc/Common_detail_api.md b/doc/Common_detail_api.md
index 661e245..f0bd8aa 100644
--- a/doc/Common_detail_api.md
+++ b/doc/Common_detail_api.md
@@ -28,20 +28,17 @@ window.JPush.init()
```
### API - stopPush
-+ Android 平台:
- + 开发者 App 可以通过调用停止推送服务 API 来停止极光推送服务,当又需要使用极光推送服务时,则必须要调用恢复推送服务 API。
+- Android:
+ - 开发者 App 可以通过调用停止推送服务 API 来停止极光推送服务,当又需要使用极光推送服务时,则必须要调用恢复推送服务 API。
+ - 调用了本 API 后,JPush 推送服务完全被停止,具体表现为:
+ - JPush Service 不在后台运行。
+ - 收不到推送消息。
+ - 不能通过 `init` 方法恢复,而需要调用 `resumePush` 恢复。
+ - 极光推送其他所有的 API 调用都无效。
- + 调用了本 API 后,JPush 推送服务完全被停止,具体表现为:
-
- + JPush Service 不在后台运行。
- + 收不到推送消息。
- + 不能通过 JPushInterface.init 恢复,需要调用 resumePush 恢复。
- + 极光推送所有的其他 API 调用都无效。
-
-+ iOS 平台:
-
- + 不推荐调用,因为这个 API 只是让你的 DeviceToken 失效,在 设置-通知 中您的应用程序没有任何变化。**建议设置一个 UI 界面, 提醒用户在 设置-通知 中关闭推送服务**。
+- iOS:
+ - 不推荐调用,因为这个 API 只是让你的 DeviceToken 失效,在 设置-通知 中您的应用程序没有任何变化。**建议设置一个 UI 界面, 提醒用户在 设置-通知 中关闭推送服务**。
#### 接口定义
@@ -53,27 +50,25 @@ window.JPush.stopPush()
恢复推送服务。调用了此 API 后:
-+ Android 平台:
+- Android 平台:
+ - 极光推送完全恢复正常工作。
- + 极光推送完全恢复正常工作。
-
-+ iOS 平台:
-
- + 重新去 APNS 注册。
+- iOS 平台:
+ - 重新去 APNS 注册。
#### 接口定义
- window.JPush.resumePush()
+```js
+window.JPush.resumePush()
+```
### API - isPushStopped
-+ Android 平台:
+- Android 平台:
+ - 用来检查 Push Service 是否已经被停止。
- + 用来检查 Push Service 是否已经被停止。
-
-+ iOS 平台:
-
- + 平台检查推送服务是否注册。
+- iOS 平台:
+ - 平台检查推送服务是否注册。
#### 接口定义
@@ -123,7 +118,9 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
#### 接口定义
- window.JPush.getRegistrationID(callback)
+```js
+window.JPush.getRegistrationID(callback)
+```
#### 返回值
@@ -370,46 +367,52 @@ window.JPush.checkTagBindState({ sequence: 1, tag: 'tag1' },
- 在你需要接收通知的的 js 文件中加入:
- document.addEventListener("jpush.openNotification", function (event) {
- var alertContent
- if(device.platform == "Android") {
- alertContent = event.alert
- } else {
- alertContent = event.aps.alert
- }
- }, false)
+```js
+document.addEventListener("jpush.openNotification", function (event) {
+ var alertContent
+ if(device.platform == "Android") {
+ alertContent = event.alert
+ } else {
+ alertContent = event.aps.alert
+ }
+}, false)
+```
> ps:点击通知后传递的 json object 保存在 window.JPush.openNotification,直接访问即可,字段示例,根据实际推送情况,可能略有差别,请注意。
-+ Android:
+- Android:
- {
- "title": "title",
- "alert":"ding",
- "extras":{
- "yourKey": "yourValue",
- "cn.jpush.android.MSG_ID": "1691785879",
- "app": "com.thi.pushtest",
- "cn.jpush.android.ALERT": "ding",
- "cn.jpush.android.EXTRA": {},
- "cn.jpush.android.PUSH_ID": "1691785879",
- "cn.jpush.android.NOTIFICATION_ID": 1691785879,
- "cn.jpush.android.NOTIFICATION_TYPE": "0"
- }
- }
+```json
+{
+ "title": "title",
+ "alert":"ding",
+ "extras":{
+ "yourKey": "yourValue",
+ "cn.jpush.android.MSG_ID": "1691785879",
+ "app": "com.thi.pushtest",
+ "cn.jpush.android.ALERT": "ding",
+ "cn.jpush.android.EXTRA": {},
+ "cn.jpush.android.PUSH_ID": "1691785879",
+ "cn.jpush.android.NOTIFICATION_ID": 1691785879,
+ "cn.jpush.android.NOTIFICATION_TYPE": "0"
+ }
+}
+```
-+ iOS:
+- iOS:
- {
- "aps":{
- "badge": 1,
- "sound": "default",
- "alert": "今天去哪儿"
- },
- "key1": "value1",
- "key2": "value2",
- "_j_msgid": 154604475
- }
+```json
+{
+ "aps": {
+ "badge": 1,
+ "sound": "default",
+ "alert": "今天去哪儿"
+ },
+ "key1": "value1",
+ "key2": "value2",
+ "_j_msgid": 154604475
+}
+```
## 获取通知内容
@@ -421,49 +424,53 @@ window.JPush.checkTagBindState({ sequence: 1, tag: 'tag1' },
- 在你需要接收通知的的 js 文件中加入:
- document.addEventListener("jpush.receiveNotification", function (event) {
- var alertContent
- if(device.platform == "Android") {
- alertContent = event.alert
- } else {
- alertContent = event.aps.alert
- }
- alert("open Notificaiton:" + alertContent)
- }, false)
-
+```js
+document.addEventListener("jpush.receiveNotification", function (event) {
+ var alertContent
+ if(device.platform == "Android") {
+ alertContent = event.alert
+ } else {
+ alertContent = event.aps.alert
+ }
+ alert("open Notification:" + alertContent)
+}, false)
+```
> ps:点击通知后传递的 json object 保存在 window.JPush.receiveNotification,直接访问即可,字段示例,根据实际推送情况,可能略有差别,请注意。
-+ Android:
+- Android:
- {
- "title": "title",
- "alert":"ding",
- "extras":{
- "yourKey": "yourValue",
- "cn.jpush.android.MSG_ID":"1691785879",
- "app":"com.thi.pushtest",
- "cn.jpush.android.ALERT":"ding",
- "cn.jpush.android.EXTRA":{},
- "cn.jpush.android.PUSH_ID":"1691785879",
- "cn.jpush.android.NOTIFICATION_ID":1691785879,
- "cn.jpush.android.NOTIFICATION_TYPE":"0"
- }
- }
+```json
+{
+ "title": "title",
+ "alert":"ding",
+ "extras":{
+ "yourKey": "yourValue",
+ "cn.jpush.android.MSG_ID":"1691785879",
+ "app":"com.thi.pushtest",
+ "cn.jpush.android.ALERT":"ding",
+ "cn.jpush.android.EXTRA":{},
+ "cn.jpush.android.PUSH_ID":"1691785879",
+ "cn.jpush.android.NOTIFICATION_ID":1691785879,
+ "cn.jpush.android.NOTIFICATION_TYPE":"0"
+ }
+}
+```
-+ iOS:
-
- {
- "aps":{
- "badge":1,
- "sound":"default",
- "alert":"今天去哪儿"
- },
- "key1":"value1",
- "key2":"value2",
- "_j_msgid":154604475
- }
+- iOS:
+```json
+{
+ "aps":{
+ "badge":1,
+ "sound":"default",
+ "alert":"今天去哪儿"
+ },
+ "key1":"value1",
+ "key2":"value2",
+ "_j_msgid":154604475
+}
+```
## 获取自定义消息推送内容
@@ -471,41 +478,47 @@ window.JPush.checkTagBindState({ sequence: 1, tag: 'tag1' },
收到自定义消息时触发这个事件,推荐使用事件的方式传递。
-但同时保留了 receiveMessageIniOSCallback 的回调函数,兼容以前的代码。
+但同时保留了 `receiveMessageIniOSCallback` 的回调函数,兼容以前的代码。
#### 代码示例
- 在你需要接收通知的的 js 文件中加入:
- document.addEventListener("jpush.receiveMessage", function (event) {
- var message
- if(device.platform == "Android") {
- message = event.message;
- } else {
- message = event.content;
- }
- }, false)
+```js
+document.addEventListener("jpush.receiveMessage", function (event) {
+ var message
+ if(device.platform == "Android") {
+ message = event.message;
+ } else {
+ message = event.content;
+ }
+}, false)
+```
> ps:点击通知后传递的 json object 保存在 window.JPush.receiveMessage,直接访问即可,字段示例,根据实际推送情况,可能略有差别,请注意。
-+ Android:
+- Android:
- {
- "message":"今天去哪儿",
- "extras"{
- "yourKey": "yourValue",
- "cn.jpush.android.MSG_ID":"154378013",
- "cn.jpush.android.CONTENT_TYPE":"",
- "cn.jpush.android.EXTRA":{"key":"不添没有"}
- }
- }
+```json
+{
+ "message":"今天去哪儿",
+ "extras"{
+ "yourKey": "yourValue",
+ "cn.jpush.android.MSG_ID":"154378013",
+ "cn.jpush.android.CONTENT_TYPE":"",
+ "cn.jpush.android.EXTRA":{ "key":"不添加没有" }
+ }
+}
+```
-+ iOS:
+- iOS:
- {
- "content":"今天去哪儿",
- "extras":{"key":"不填写没有"}
- }
+```json
+{
+ "content":"今天去哪儿",
+ "extras":{ "key":"不添加没有" }
+}
+```
## 判断系统设置中是否允许当前应用推送
### API - getUserNotificationSettings
@@ -515,17 +528,19 @@ window.JPush.checkTagBindState({ sequence: 1, tag: 'tag1' },
在 iOS 中,返回值为 0 时,代表系统设置中关闭了推送;大于 0 时,代表打开了推送,且能够根据返回值判断具体通知形式:
- UIRemoteNotificationTypeNone = 0, // 0
- UIRemoteNotificationTypeBadge = 1 << 0, // 1
- UIRemoteNotificationTypeSound = 1 << 1, // 2
- UIRemoteNotificationTypeAlert = 1 << 2, // 4
- UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3 // 8
+UIRemoteNotificationTypeNone = 0, // 0
+UIRemoteNotificationTypeBadge = 1 << 0, // 1
+UIRemoteNotificationTypeSound = 1 << 1, // 2
+UIRemoteNotificationTypeAlert = 1 << 2, // 4
+UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3 // 8
#### 代码示例
- window.JPush.getUserNotificationSettings(function(result) {
- if(result == 0) {
- // 系统设置中已关闭应用推送。
- } else if(result > 0) {
- // 系统设置中打开了应用推送。
- })
+```js
+window.JPush.getUserNotificationSettings(function(result) {
+ if(result == 0) {
+ // 系统设置中已关闭应用推送。
+ } else if(result > 0) {
+ // 系统设置中打开了应用推送。
+ })
+ ```
diff --git a/doc/iOS_API.md b/doc/iOS_API.md
index 2047a6e..883fea2 100644
--- a/doc/iOS_API.md
+++ b/doc/iOS_API.md
@@ -3,7 +3,6 @@
- [延迟注册和启动推送通知服务](#延迟注册和启动推送通知服务)
- [开始与停止推送服务](#开始与停止推送服务)
- [获取 RegistrationID](#获取-registrationid)
-- [别名与标签](#别名与标签)
- [获取 APNS 推送内容](#获取-apns-推送内容)
- [点击推送通知](#点击推送通知)
- [前台收到推送](#前台收到推送)
@@ -39,7 +38,7 @@
#### 接口定义
```js
-window.plugins.jPushPlugin.startJPushSDK()
+window.JPush.startJPushSDK()
```
## 开始与停止推送服务
@@ -59,7 +58,7 @@ JPush SDK 会恢复正常的默认行为。(因为保存在本地的状态数
#### 接口定义
```js
-window.plugins.jPushPlugin.init()
+window.JPush.init()
```
### API - stopPush
@@ -70,7 +69,7 @@ window.plugins.jPushPlugin.init()
#### 接口定义
```js
-window.plugins.jPushPlugin.stopPush()
+window.JPush.stopPush()
```
### API - resumePush
@@ -80,7 +79,7 @@ window.plugins.jPushPlugin.stopPush()
#### 接口定义
```js
-window.plugins.jPushPlugin.resumePush()
+window.JPush.resumePush()
```
### API - isPushStopped
@@ -90,7 +89,7 @@ iOS平台,检查推送服务是否停止。
#### 接口定义
```js
-window.plugins.jPushPlugin.isPushStopped(callback)
+window.JPush.isPushStopped(callback)
```
#### 参数说明
@@ -100,7 +99,7 @@ window.plugins.jPushPlugin.isPushStopped(callback)
#### 代码示例
```js
-window.plugins.jPushPlugin.isPushStopped(function(data) {
+window.JPush.isPushStopped(function(data) {
if(data > 0) {
// 已关闭
} else {
@@ -133,80 +132,11 @@ JPushPlugin.getRegistrationID(callback)
#### 调用示例
```js
-window.plugins.jPushPlugin.getRegistrationID(function(data) {
+window.JPush.getRegistrationID(function(data) {
console.log("JPushPlugin:registrationID is " + data)
})
```
-## 别名与标签
-
-### API - setTagsWithAlias, setTags, setAlias
-
-提供几个相关 API 用来设置别名(alias)与标签(tags)。
-
-这几个 API 可以在 App 里任何地方调用。
-
-**别名 Alias**
-
-为安装了应用程序的用户,取个别名来标识。以后给该用户 Push 消息时,就可以用此别名来指定。
-
-每个用户只能指定一个别名。
-
-同一个应用程序内,对不同的用户,建议取不同的别名。这样,尽可能根据别名来唯一确定用户。
-
-系统不限定一个别名只能指定一个用户。如果一个别名被指定到了多个用户,当给指定这个别名发消息时,服务器端 API 会同时给这多个用户发送消息。
-
-举例:在一个用户要登录的游戏中,可能设置别名为 userId。游戏运营时,发现该用户 3 天没有玩游戏了,则根据 userId 调用服务器端 API 发通知到客户端提醒用户。
-
-**标签 Tag**
-
-为安装了应用程序的用户,打上标签。其目的主要是方便开发者根据标签,来批量下发 Push 消息。
-
-可为每个用户打多个标签。
-
-不同应用程序、不同的用户,可以打同样的标签。
-
-举例: game, old_page, women。
-
-#### 接口定义
-
-```js
-window.plugins.jPushPlugin.setTagsWithAlias(tags, alias, successCallback, errorCallback)
-window.plugins.jPushPlugin.setTags(tags, successCallback)
-window.plugins.jPushPlugin.setAlias(alias, errorCallback)
-```
-
-#### 参数说明
-
-- tags:
- - 参数类型为数组。
- - nil 此次调用不设置此值。
- - 空集合表示取消之前的设置。
- - 每次调用至少设置一个 tag,覆盖之前的设置,不是新增。
- - 有效的标签组成:字母(区分大小写)、数字、下划线、汉字。
- - 限制:每个 tag 命名长度限制为 40 字节,最多支持设置 100 个 tag,但总长度不得超过1K字节(判断长度需采用UTF-8编码)。
- - 单个设备最多支持设置 100 个 tag,App 全局 tag 数量无限制。
-- alias:
- - 参数类型为字符串。
- - nil 此次调用不设置此值。
- - 空字符串 ("")表示取消之前的设置。
- - 有效的别名组成:字母(区分大小写)、数字、下划线、汉字。
- - 限制:alias 命名长度限制为 40 字节(判断长度需采用 UTF-8 编码)。
-
-#### 错误码定义
-
-| Code | 描述 | 详细解释 |
-| ---- | :-------------------------- | :-------------------------------- |
-| 6001 | 无效的设置,tag/alias 不应参数都为 null | |
-| 6002 | 设置超时 | 建议重试。 |
-| 6003 | alias 字符串不合法 | 有效的别名、标签组成:字母(区分大小写)、数字、下划线、汉字。 |
-| 6004 | alias超长 | 最多 40 个字节(中文 UTF-8 是 3 个字节)。 |
-| 6005 | 某一个 tag 字符串不合法 | 有效的别名、标签组成:字母(区分大小写)、数字、下划线、汉字。 |
-| 6006 | 某一个 tag 超长 | 一个 tag 最多 40 个字节(中文 UTF-8 是 3 个字节)。 |
-| 6007 | tags 数量超出限制(最多 100 个) | 这是一台设备的限制。一个应用全局的标签数量无限制。 |
-| 6008 | tag/alias 超出总长度限制 | 总长度最多 1K 字节。 |
-| 6011 | 10 秒内设置 tag 或 alias 大于 3 次 | 短时间内操作过于频繁。 |
-
## 获取 APNS 推送内容
### 点击推送通知
@@ -372,8 +302,8 @@ JPush 封装 badge 功能,允许应用上传 badge 值至 JPush 服务器,
#### 接口定义
```js
-window.plugins.jPushPlugin.setBadge(value)
-window.plugins.jPushPlugin.resetBadge()
+window.JPush.setBadge(value)
+window.JPush.resetBadge()
```
`resetBadge` 相当于 `setBadge(0)`。
@@ -389,8 +319,8 @@ value 取值范围:0 ~ 99999。
#### 代码示例
```js
-window.plugins.jPushPlugin.setBadge(5)
-window.plugins.jPushPlugin.resetBadge()
+window.JPush.setBadge(5)
+window.JPush.resetBadge()
```
### API - setApplicationIconBadgeNumber
@@ -400,7 +330,7 @@ window.plugins.jPushPlugin.resetBadge()
#### 接口定义
```js
-window.plugins.jPushPlugin.setApplicationIconBadgeNumber(badge)
+window.JPush.setApplicationIconBadgeNumber(badge)
```
#### 参数说明
@@ -410,7 +340,7 @@ window.plugins.jPushPlugin.setApplicationIconBadgeNumber(badge)
#### 代码示例
```js
-window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0)
+window.JPush.setApplicationIconBadgeNumber(0)
```
### API - getApplicationIconBadgeNumber
@@ -420,7 +350,7 @@ window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0)
#### 接口定义
```js
-window.plugins.jPushPlugin.getApplicationIconBadgeNumber(callback)
+window.JPush.getApplicationIconBadgeNumber(callback)
```
#### 参数说明
@@ -430,7 +360,7 @@ window.plugins.jPushPlugin.getApplicationIconBadgeNumber(callback)
#### 代码示例
```js
-window.plugins.jPushPlugin.getApplicationIconBadgeNumber(function(badgeNum) {
+window.JPush.getApplicationIconBadgeNumber(function(badgeNum) {
console.log(badgeNum)
})
```
@@ -444,7 +374,7 @@ window.plugins.jPushPlugin.getApplicationIconBadgeNumber(function(badgeNum) {
#### 接口定义
```js
-window.plugins.jPushPlugin.addLocalNotificationForIOS(delayTime, content, badge, notificationID, extras)
+window.JPush.addLocalNotificationForIOS(delayTime, content, badge, notificationID, extras)
```
#### 参数说明
@@ -458,7 +388,7 @@ window.plugins.jPushPlugin.addLocalNotificationForIOS(delayTime, content, badge,
#### 代码示例
```js
-window.plugins.jPushPlugin.addLocalNotificationForIOS(24*60*60, "本地推送内容", 1, "notiId", {"key":"value"});
+window.JPush.addLocalNotificationForIOS(24*60*60, "本地推送内容", 1, "notiId", {"key":"value"});
```
### API - deleteLocalNotificationWithIdentifierKeyInIOS
@@ -468,7 +398,7 @@ window.plugins.jPushPlugin.addLocalNotificationForIOS(24*60*60, "本地推送内
#### 接口定义
```js
-window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey)
+window.JPush.deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey)
```
#### 参数说明
@@ -478,7 +408,7 @@ window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS(identif
#### 代码示例
```js
-window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS("identifier")
+window.JPush.deleteLocalNotificationWithIdentifierKeyInIOS("identifier")
```
### API - clearAllLocalNotifications
@@ -488,13 +418,13 @@ window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS("identi
#### 接口定义
```js
-window.plugins.jPushPlugin.clearAllLocalNotifications()
+window.JPush.clearAllLocalNotifications()
```
#### 代码示例
```js
-window.plugins.jPushPlugin.clearAllLocalNotifications()
+window.JPush.clearAllLocalNotifications()
```
## 获取本地通知内容
@@ -521,9 +451,9 @@ window.plugins.jPushPlugin.clearAllLocalNotifications()
#### 接口定义
```js
-window.plugins.jPushPlugin.startLogPageView(pageName)
-window.plugins.jPushPlugin.stopLogPageView(pageName)
-window.plugins.jPushPlugin.beginLogPageView(pageName, duration)
+window.JPush.startLogPageView(pageName)
+window.JPush.stopLogPageView(pageName)
+window.JPush.beginLogPageView(pageName, duration)
```
#### 参数说明
@@ -540,9 +470,9 @@ window.plugins.jPushPlugin.beginLogPageView(pageName, duration)
#### 代码示例
```js
-window.plugins.jPushPlugin.beginLogPageView("newPage", 5);
-window.plugins.jPushPlugin.startLogPageView("onePage");
-window.plugins.jPushPlugin.stopLogPageView("onePage");
+window.JPush.beginLogPageView("newPage", 5);
+window.JPush.startLogPageView("onePage");
+window.JPush.stopLogPageView("onePage");
```
## 日志等级设置
@@ -556,7 +486,7 @@ window.plugins.jPushPlugin.stopLogPageView("onePage");
#### 接口定义
```js
-window.plugins.jPushPlugin.setDebugModeFromIos();
+window.JPush.setDebugModeFromIos();
```
### API - setLogOFF
@@ -568,7 +498,7 @@ window.plugins.jPushPlugin.setDebugModeFromIos();
#### 接口定义
```js
-window.plugins.jPushPlugin.setLogOFF();
+window.JPush.setLogOFF();
```
### API - setCrashLogON
@@ -580,7 +510,7 @@ window.plugins.jPushPlugin.setLogOFF();
#### 接口定义
```js
-window.plugins.jPushPlugin.setCrashLogON();
+window.JPush.setCrashLogON();
```
## 地理位置上报
@@ -592,7 +522,7 @@ window.plugins.jPushPlugin.setCrashLogON();
#### 接口定义
```js
-window.plugins.jPushPlugin.prototype.setLocation(latitude, longitude)
+window.JPush.prototype.setLocation(latitude, longitude)
```
#### 参数说明
@@ -609,13 +539,13 @@ window.plugins.jPushPlugin.prototype.setLocation(latitude, longitude)
#### 接口定义
```js
-window.plugins.jPushPlugin.isPlatformIOS()
+window.JPush.isPlatformIOS()
```
#### 代码示例
```js
-if(window.plugins.jPushPlugin.isPlatformIOS()) {
+if(window.JPush.isPlatformIOS()) {
// iOS
} else {
// Android
@@ -639,7 +569,7 @@ if(window.plugins.jPushPlugin.isPlatformIOS()) {
#### 接口定义
```js
-window.plugins.jPushPlugin.addDismissActions(actions, categoryId);
+window.JPush.addDismissActions(actions, categoryId);
```
#### 参数说明
@@ -660,7 +590,7 @@ window.plugins.jPushPlugin.addDismissActions(actions, categoryId);
#### 代码示例
```js
-window.plugins.jPushPlugin.addDismissActions([
+window.JPush.addDismissActions([
{"title":"t1", "identifier":"id1", "option":"0"},
{"title":"t2", "identifier":"id2", "option":"3", "type":"textInput", "textInputButtonTitle":"回复", "textInputPlaceholder":"点此输入回复内容"}], "categoryId_t1_t2");
```
@@ -680,7 +610,7 @@ iPhone 6s 及以后设备且 iOS 9 以后系统支持 3d-touch。
#### 接口定义
```js
-window.plugins.jPushPlugin.addNotificationActions(actions, categoryId)
+window.JPush.addNotificationActions(actions, categoryId)
```
#### 参数说明
@@ -742,7 +672,7 @@ window.plugins.jPushPlugin.addNotificationActions(actions, categoryId)
#### 接口定义
```js
-window.plugins.jPushPlugin.getUserNotificationSettings(callback)
+window.JPush.getUserNotificationSettings(callback)
```
#### 返回值