mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-04-19 00:03:45 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 031acb9631 | |||
| 8d098d29b1 | |||
| a9343ac776 | |||
| de58071773 | |||
| 13341fd68a | |||
| edf29bbc8d | |||
| ae54960da4 | |||
| ea6011635f | |||
| 0829104534 | |||
| 592d5a5fb9 | |||
| 4753174bda | |||
| 3f077e32fd | |||
| 5c569d00da | |||
| c5f7963425 | |||
| a4eaf51455 | |||
| 04fae7d538 | |||
| 8e087e102a | |||
| 35c09c0c92 | |||
| f0a87962e7 |
-30
@@ -36,34 +36,4 @@ Network Trash Folder
|
|||||||
Temporary Items
|
Temporary Items
|
||||||
.apdisk
|
.apdisk
|
||||||
|
|
||||||
# Ionic example
|
|
||||||
ionic/example/.sourcemaps/*
|
|
||||||
ionic/example/node_modules/*
|
|
||||||
ionic/example/plugins/*
|
|
||||||
ionic/example/config.xml
|
|
||||||
ionic/example/ionic.config.json
|
|
||||||
ionic/example/package-lock.json
|
|
||||||
ionic/example/package.json
|
|
||||||
ionic/example/tsconfig.json
|
|
||||||
ionic/example/tslint.json
|
|
||||||
ionic/example/resources/README\.md
|
|
||||||
ionic/example/www/*
|
|
||||||
ionic/example/src/assets/*
|
|
||||||
ionic/example/src/theme
|
|
||||||
ionic/example/platforms
|
|
||||||
|
|
||||||
ionic/example/src/manifest\.json
|
|
||||||
|
|
||||||
ionic/example/resources/android/splash/
|
|
||||||
|
|
||||||
ionic/example/resources/
|
|
||||||
|
|
||||||
ionic/example/src/service-worker\.js
|
|
||||||
|
|
||||||
ionic/example/src/index\.html
|
|
||||||
|
|
||||||
ionic/example/src/app/app\.scss
|
|
||||||
|
|
||||||
ionic/example/src/app/main\.ts
|
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/macos,apachecordova
|
# End of https://www.gitignore.io/api/macos,apachecordova
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# JPush PhoneGap / Cordova Plugin
|
# JPush PhoneGap / Cordova Plugin
|
||||||
|
|
||||||
[](https://travis-ci.org/jpush/jpush-phonegap-plugin)
|
[](https://travis-ci.org/jpush/jpush-phonegap-plugin)
|
||||||
[](https://github.com/jpush/jpush-phonegap-plugin/releases)
|
[](https://github.com/jpush/jpush-phonegap-plugin/releases)
|
||||||
[](https://github.com/jpush/jpush-phonegap-plugin)
|
[](https://github.com/jpush/jpush-phonegap-plugin)
|
||||||
[](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
|
[](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
|
||||||
|
|
||||||
@@ -11,15 +11,8 @@
|
|||||||
- 如需要短信验证码功能插件,可关注 [cordova-plugin-jsms](https://github.com/jpush/cordova-plugin-jsms)
|
- 如需要短信验证码功能插件,可关注 [cordova-plugin-jsms](https://github.com/jpush/cordova-plugin-jsms)
|
||||||
- 如需要统计分析功能插件,可关注 [cordova-plugin-janalytics](https://github.com/jpush/cordova-plugin-janalytics)
|
- 如需要统计分析功能插件,可关注 [cordova-plugin-janalytics](https://github.com/jpush/cordova-plugin-janalytics)
|
||||||
|
|
||||||
注意:目前插件暂未支持 cordova-android 7.0.0,因此在添加 android platform 时,请指定 7.0.0 以下版本,例如 6.4.0。
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
> 注意:
|
|
||||||
>
|
|
||||||
> - 应用的包名一定要和 APP_KEY 对应应用的包名一致,否则极光推送服务无法注册成功。
|
|
||||||
> - 在使用 8 或以上版本的 Xcode 调试 iOS 项目时,需要先在项目配置界面的 Capabilities 中打开 Push Notifications 开关。
|
|
||||||
|
|
||||||
- 通过 Cordova Plugins 安装,要求 Cordova CLI 5.0+:
|
- 通过 Cordova Plugins 安装,要求 Cordova CLI 5.0+:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
@@ -35,31 +28,10 @@
|
|||||||
- 或下载到本地安装:
|
- 或下载到本地安装:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cordova plugin add Your_Plugin_Path --variable APP_KEY=your_jpush_appkey
|
cordova plugin add Your_Plugin_Path --variable APP_KEY=your_jpush_appkey
|
||||||
```
|
```
|
||||||
|
|
||||||
### Ionic
|
> 在使用 Xcode 8 调试 iOS 项目时,需要先在项目配置界面的 Capabilities 中打开 Push Notifications 开关。
|
||||||
|
|
||||||
如果使用了 Ionic,可以再安装 @jiguang-ionic/jpush 包,适配 ionic-native:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm install --save @jiguang-ionic/jpush
|
|
||||||
```
|
|
||||||
|
|
||||||
然后在 *app.module.ts* 中增加:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { JPush } from '@jiguang-ionic/jpush';
|
|
||||||
...
|
|
||||||
providers: [
|
|
||||||
...
|
|
||||||
JPush,
|
|
||||||
...
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
具体可参考 ./ionic/example 中的文件。
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -100,13 +72,14 @@ import { JPush } from '@jiguang-ionic/jpush';
|
|||||||
Android 因为各 Rom 的高度定制化,不像 iOS 一样能有一个统一的管理,如果在 Android 中想自定义通知铃声,推荐通过 JPush 推送自定义
|
Android 因为各 Rom 的高度定制化,不像 iOS 一样能有一个统一的管理,如果在 Android 中想自定义通知铃声,推荐通过 JPush 推送自定义
|
||||||
消息,之后在 `jpush.receiveMessage` 事件监听中通过 [Cordova Local-Notification Plugin](https://github.com/katzer/cordova-plugin-local-notifications) 触发通知,再配合 [Cordova Background Plugin](https://github.com/katzer/cordova-plugin-background-mode) 插件保证应用的后台运行。
|
消息,之后在 `jpush.receiveMessage` 事件监听中通过 [Cordova Local-Notification Plugin](https://github.com/katzer/cordova-plugin-local-notifications) 触发通知,再配合 [Cordova Background Plugin](https://github.com/katzer/cordova-plugin-background-mode) 插件保证应用的后台运行。
|
||||||
|
|
||||||
#### 如何让通知内容像 iOS 一样自动换行展示?
|
#### 如果让通知内容像 iOS 一样换行展示?
|
||||||
|
|
||||||
[#267](https://github.com/jpush/jpush-phonegap-plugin/issues/267)
|
[#267](https://github.com/jpush/jpush-phonegap-plugin/issues/267)
|
||||||
|
|
||||||
#### 关闭 App 后收不到通知
|
#### 关闭 App 后收不到通知
|
||||||
|
|
||||||
Android 的推送通过长连接的方式实现,只有在保持连接的情况下才能收到通知。而有的第三方 ROM 会限制一般应用服务的自启动,也就是在退出应用后,应用的所有服务均被杀死,且无法自启动,所以就会收不到通知。
|
Android 的推送通过长连接的方式实现,只有在连接保持的情况下才能收到通知。而有的第三方 ROM 会限制一般应用服务的自启动,也就是
|
||||||
|
在退出应用后,应用的所有服务均被杀死,且无法自启动,所以就会收不到通知。
|
||||||
|
|
||||||
目前 JPush 是做了应用互相拉起机制的,也就是当用户打开其他集成了 JPush 的应用时,你的应用也能同时收到推送消息。
|
目前 JPush 是做了应用互相拉起机制的,也就是当用户打开其他集成了 JPush 的应用时,你的应用也能同时收到推送消息。
|
||||||
|
|
||||||
@@ -125,6 +98,10 @@ Android 的推送通过长连接的方式实现,只有在保持连接的情况
|
|||||||
cordova platform update ios
|
cordova platform update ios
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### ionic 2 如何调用 API?
|
||||||
|
|
||||||
|
[issue 179](https://github.com/jpush/jpush-phonegap-plugin/issues/179)
|
||||||
|
|
||||||
#### PushConfig.plist 文件中的字段都是什么意思?
|
#### PushConfig.plist 文件中的字段都是什么意思?
|
||||||
|
|
||||||
- Appkey:应用标识。
|
- Appkey:应用标识。
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# Android API 简介
|
# Android API 简介
|
||||||
|
|
||||||
|
- [注册成功事件](#注册成功事件)
|
||||||
|
- [获取集成日志(同时适用于 iOS)](#获取集成日志同时适用于-ios)
|
||||||
- [清除通知](#清除通知)
|
- [清除通知](#清除通知)
|
||||||
- [设置允许推送时间](#设置允许推送时间)
|
- [设置允许推送时间](#设置允许推送时间)
|
||||||
- [设置通知静默时间](#设置通知静默时间)
|
- [设置通知静默时间](#设置通知静默时间)
|
||||||
@@ -7,6 +9,19 @@
|
|||||||
- [设置保留最近通知条数](#设置保留最近通知条数)
|
- [设置保留最近通知条数](#设置保留最近通知条数)
|
||||||
- [本地通知](#本地通知)
|
- [本地通知](#本地通知)
|
||||||
|
|
||||||
|
## 注册成功事件
|
||||||
|
### jpush.receiveRegistrationId
|
||||||
|
集成了 JPush SDK 的应用程序在第一次成功注册到 JPush 服务器时,JPush 服务器会给客户端返回一个唯一的该设备的标识 - RegistrationID。
|
||||||
|
就会触发这个事件(注意只有第一次会触发该事件,之后如果想要取到 registrationId,可以直接调用 *getRegistrationID* 方法)。
|
||||||
|
|
||||||
|
#### 代码示例
|
||||||
|
|
||||||
|
```js
|
||||||
|
document.addEventListener('jpush.receiveRegistrationId', function (event) {
|
||||||
|
console.log(event.registrationId)
|
||||||
|
}, false)
|
||||||
|
```
|
||||||
|
|
||||||
## 获取集成日志(同时适用于 iOS)
|
## 获取集成日志(同时适用于 iOS)
|
||||||
|
|
||||||
### API - setDebugMode
|
### API - setDebugMode
|
||||||
@@ -88,7 +103,7 @@ window.JPush.setPushTime(days, startHour, endHour)
|
|||||||
#### 参数说明
|
#### 参数说明
|
||||||
|
|
||||||
- days: 数组,0 表示星期天,1 表示星期一,以此类推(7天制,数组中值的范围为 0 到 6 )。
|
- days: 数组,0 表示星期天,1 表示星期一,以此类推(7天制,数组中值的范围为 0 到 6 )。
|
||||||
数组的值为 null, 表示任何时间都可以收到消息和通知,数组的 size 为 0,则表示任何时间都收不到消息和通知。
|
数组的值为 null, 表示任何时间都可以收到消息和通知,数组的 size 为 0,则表示任何时间都收不到消息和通知。
|
||||||
- startHour: 整形,允许推送的开始时间 (24 小时制:startHour 的范围为 0 到 23)。
|
- startHour: 整形,允许推送的开始时间 (24 小时制:startHour 的范围为 0 到 23)。
|
||||||
- endHour: 整形,允许推送的结束时间 (24 小时制:endHour 的范围为 0 到 23)。
|
- endHour: 整形,允许推送的结束时间 (24 小时制:endHour 的范围为 0 到 23)。
|
||||||
|
|
||||||
|
|||||||
+19
-52
@@ -1,52 +1,15 @@
|
|||||||
# 通用 API 说明(同时适用于 Android 和 iOS 系统)
|
# 通用 API 说明(同时适用于 Android 和 iOS 系统)
|
||||||
|
|
||||||
- [注册成功事件](#注册成功事件)
|
- [停止与恢复推送服务](#停止与恢复推送服务)
|
||||||
- [jpush.receiveRegistrationId](#jpushreceiveregistrationid)
|
|
||||||
- [初始化、停止与恢复推送服务](#初始化停止与恢复推送服务)
|
|
||||||
- [init](#init)
|
|
||||||
- [stopPush](#stoppush)
|
|
||||||
- [resumePush](#resumepush)
|
|
||||||
- [isPushStopped](#ispushstopped)
|
|
||||||
- [开启 Debug 模式](#开启-debug-模式)
|
|
||||||
- [setDebugMode](#setdebugmode)
|
|
||||||
- [获取 RegistrationID](#获取-registrationid)
|
- [获取 RegistrationID](#获取-registrationid)
|
||||||
- [getRegistrationID](#getregistrationid)
|
|
||||||
- [设置别名与标签](#设置别名与标签)
|
- [设置别名与标签](#设置别名与标签)
|
||||||
- [setAlias](#setalias)
|
|
||||||
- [deleteAlias](#deletealias)
|
|
||||||
- [getAlias](#getalias)
|
|
||||||
- [setTags](#settags)
|
|
||||||
- [addTags](#addtags)
|
|
||||||
- [deleteTags](#deletetags)
|
|
||||||
- [cleanTags](#cleantags)
|
|
||||||
- [getAllTags](#getalltags)
|
|
||||||
- [checkTagBindState](#checktagbindstate)
|
|
||||||
- [获取点击通知内容](#获取点击通知内容)
|
- [获取点击通知内容](#获取点击通知内容)
|
||||||
- [event - jpush.openNotification](#event---jpushopennotification)
|
|
||||||
- [获取通知内容](#获取通知内容)
|
- [获取通知内容](#获取通知内容)
|
||||||
- [event - jpush.receiveNotification](#event---jpushreceivenotification)
|
|
||||||
- [获取自定义消息推送内容](#获取自定义消息推送内容)
|
- [获取自定义消息推送内容](#获取自定义消息推送内容)
|
||||||
- [event - jpush.receiveMessage](#event---jpushreceivemessage)
|
|
||||||
- [判断系统设置中是否允许当前应用推送](#判断系统设置中是否允许当前应用推送)
|
- [判断系统设置中是否允许当前应用推送](#判断系统设置中是否允许当前应用推送)
|
||||||
|
|
||||||
## 注册成功事件
|
## 停止与恢复推送服务
|
||||||
|
### API - init
|
||||||
### jpush.receiveRegistrationId
|
|
||||||
|
|
||||||
集成了 JPush SDK 的应用程序在第一次成功注册到 JPush 服务器时,JPush 服务器会给客户端返回一个唯一的该设备的标识 - Registration ID。
|
|
||||||
此时就会触发这个事件(注意只有第一次会触发该事件,之后如果想要取到 Registration Id,可以直接调用 `getRegistrationID` 方法)。
|
|
||||||
|
|
||||||
#### 代码示例
|
|
||||||
|
|
||||||
```js
|
|
||||||
document.addEventListener('jpush.receiveRegistrationId', function (event) {
|
|
||||||
console.log(event.registrationId)
|
|
||||||
}, false)
|
|
||||||
```
|
|
||||||
|
|
||||||
## 初始化、停止与恢复推送服务
|
|
||||||
|
|
||||||
### init
|
|
||||||
|
|
||||||
调用此 API,用来开启 JPush SDK 提供的推送服务。
|
调用此 API,用来开启 JPush SDK 提供的推送服务。
|
||||||
|
|
||||||
@@ -64,7 +27,7 @@ document.addEventListener('jpush.receiveRegistrationId', function (event) {
|
|||||||
window.JPush.init()
|
window.JPush.init()
|
||||||
```
|
```
|
||||||
|
|
||||||
### stopPush
|
### API - stopPush
|
||||||
|
|
||||||
- Android:
|
- Android:
|
||||||
- 开发者 App 可以通过调用停止推送服务 API 来停止极光推送服务,当又需要使用极光推送服务时,则必须要调用恢复推送服务 API。
|
- 开发者 App 可以通过调用停止推送服务 API 来停止极光推送服务,当又需要使用极光推送服务时,则必须要调用恢复推送服务 API。
|
||||||
@@ -83,7 +46,7 @@ window.JPush.init()
|
|||||||
window.JPush.stopPush()
|
window.JPush.stopPush()
|
||||||
```
|
```
|
||||||
|
|
||||||
### resumePush
|
### API - resumePush
|
||||||
|
|
||||||
恢复推送服务。调用了此 API 后:
|
恢复推送服务。调用了此 API 后:
|
||||||
|
|
||||||
@@ -99,7 +62,7 @@ window.JPush.stopPush()
|
|||||||
window.JPush.resumePush()
|
window.JPush.resumePush()
|
||||||
```
|
```
|
||||||
|
|
||||||
### isPushStopped
|
### API - isPushStopped
|
||||||
|
|
||||||
- Android 平台:
|
- Android 平台:
|
||||||
- 用来检查 Push Service 是否已经被停止。
|
- 用来检查 Push Service 是否已经被停止。
|
||||||
@@ -130,7 +93,7 @@ window.JPush.isPushStopped(function (result) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
## 开启 Debug 模式
|
## 开启 Debug 模式
|
||||||
### setDebugMode
|
### API - setDebugMode
|
||||||
用于开启 Debug 模式,显示更多的日志信息。
|
用于开启 Debug 模式,显示更多的日志信息。
|
||||||
|
|
||||||
#### 代码示例
|
#### 代码示例
|
||||||
@@ -140,13 +103,11 @@ window.JPush.setDebugMode(true)
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### 参数说明
|
#### 参数说明
|
||||||
|
- isOpen: true,开启 Debug 模式;false,关闭 Debug 模式,不显示错误信息之外的日志信息。
|
||||||
- true: 开启 Debug 模式;
|
|
||||||
- false: 关闭 Debug 模式,不显示错误信息之外的日志信息。
|
|
||||||
|
|
||||||
## 获取 RegistrationID
|
## 获取 RegistrationID
|
||||||
|
|
||||||
### getRegistrationID
|
### API - getRegistrationID
|
||||||
|
|
||||||
RegistrationID 定义:
|
RegistrationID 定义:
|
||||||
|
|
||||||
@@ -400,7 +361,7 @@ window.JPush.checkTagBindState({ sequence: 1, tag: 'tag1' },
|
|||||||
|
|
||||||
### event - jpush.openNotification
|
### event - jpush.openNotification
|
||||||
|
|
||||||
点击通知进入应用程序时触发。
|
点击通知进入应用程序时会出发改事件。
|
||||||
|
|
||||||
#### 代码示例
|
#### 代码示例
|
||||||
|
|
||||||
@@ -417,6 +378,8 @@ document.addEventListener("jpush.openNotification", function (event) {
|
|||||||
}, false)
|
}, false)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> ps:点击通知后传递的 json object 保存在 window.JPush.openNotification,直接访问即可,字段示例,根据实际推送情况,可能略有差别,请注意。
|
||||||
|
|
||||||
- Android:
|
- Android:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@@ -455,7 +418,7 @@ document.addEventListener("jpush.openNotification", function (event) {
|
|||||||
|
|
||||||
### event - jpush.receiveNotification
|
### event - jpush.receiveNotification
|
||||||
|
|
||||||
收到通知时触发。
|
收到通知时会触发该事件。
|
||||||
|
|
||||||
#### 代码示例
|
#### 代码示例
|
||||||
|
|
||||||
@@ -473,6 +436,8 @@ document.addEventListener("jpush.receiveNotification", function (event) {
|
|||||||
}, false)
|
}, false)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> ps:点击通知后传递的 json object 保存在 window.JPush.receiveNotification,直接访问即可,字段示例,根据实际推送情况,可能略有差别,请注意。
|
||||||
|
|
||||||
- Android:
|
- Android:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@@ -511,7 +476,7 @@ document.addEventListener("jpush.receiveNotification", function (event) {
|
|||||||
|
|
||||||
### event - jpush.receiveMessage
|
### event - jpush.receiveMessage
|
||||||
|
|
||||||
收到自定义消息时触发,推荐使用事件的方式传递。
|
收到自定义消息时触发这个事件,推荐使用事件的方式传递。
|
||||||
|
|
||||||
但同时保留了 `receiveMessageIniOSCallback` 的回调函数,兼容以前的代码。
|
但同时保留了 `receiveMessageIniOSCallback` 的回调函数,兼容以前的代码。
|
||||||
|
|
||||||
@@ -530,6 +495,8 @@ document.addEventListener("jpush.receiveMessage", function (event) {
|
|||||||
}, false)
|
}, false)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> ps:点击通知后传递的 json object 保存在 window.JPush.receiveMessage,直接访问即可,字段示例,根据实际推送情况,可能略有差别,请注意。
|
||||||
|
|
||||||
- Android:
|
- Android:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@@ -578,4 +545,4 @@ window.JPush.getUserNotificationSettings(function(result) {
|
|||||||
} else if(result > 0) {
|
} else if(result > 0) {
|
||||||
// 系统设置中打开了应用推送。
|
// 系统设置中打开了应用推送。
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|||||||
+2
-30
@@ -143,7 +143,7 @@ window.JPush.getRegistrationID(function(data) {
|
|||||||
|
|
||||||
#### event - jpush.openNotification
|
#### event - jpush.openNotification
|
||||||
|
|
||||||
点击通知(包括 localNotification 和 remoteNotification)启动或唤醒应用程序时会触发该事件
|
点击通知启动或唤醒应用程序时会出发该事件
|
||||||
|
|
||||||
#### 代码示例
|
#### 代码示例
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ window.JPush.addLocalNotificationForIOS(delayTime, content, badge, notificationI
|
|||||||
|
|
||||||
#### 参数说明
|
#### 参数说明
|
||||||
|
|
||||||
- delayTime: 本地推送延迟多长时间后显示,数值类型或纯数字的字符型均可,单位为秒。
|
- delayTime: 本地推送延迟多长时间后显示,数值类型或纯数字的字符型均可。
|
||||||
- content: 本地推送需要显示的内容。
|
- content: 本地推送需要显示的内容。
|
||||||
- badge: 角标的数字。如果不需要改变角标传-1。数值类型或纯数字的字符型均可。
|
- badge: 角标的数字。如果不需要改变角标传-1。数值类型或纯数字的字符型均可。
|
||||||
- notificationID: 本地推送标识符,字符串。
|
- notificationID: 本地推送标识符,字符串。
|
||||||
@@ -433,34 +433,6 @@ window.JPush.clearAllLocalNotifications()
|
|||||||
|
|
||||||
监听 `jpush.receiveLocalNotification` 事件获取,「App 在后台时点击通知横幅」或「App 在前台时收到」均会触发该事件。
|
监听 `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 收到本地通知
|
### iOS 10 收到本地通知
|
||||||
|
|
||||||
监听 [jpush.receiveNotification](#前台收到推送)、[jpush.openNotification](点击推送通知),获取推送内容后,通过获取到的 `__JPUSHNotificationKey` 字段([本地通知](#本地通知) 设置的 `notificationID`)来判断是本地通知,并处理。
|
监听 [jpush.receiveNotification](#前台收到推送)、[jpush.openNotification](点击推送通知),获取推送内容后,通过获取到的 `__JPUSHNotificationKey` 字段([本地通知](#本地通知) 设置的 `notificationID`)来判断是本地通知,并处理。
|
||||||
|
|||||||
+16
-20
@@ -9,13 +9,7 @@
|
|||||||
<script type="text/javascript" src="js/jquery.mobile-1.1.1.js"></script>
|
<script type="text/javascript" src="js/jquery.mobile-1.1.1.js"></script>
|
||||||
<script type="text/javascript" src="cordova.js"></script>
|
<script type="text/javascript" src="cordova.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var onDeviceReady = function() {
|
var onDeviceReady = function() {
|
||||||
document.addEventListener("jpush.receiveRegistrationId", function (event) {
|
|
||||||
alert("receiveRegistrationId" + JSON.stringify(event));
|
|
||||||
$("#registrationId").html(event.registrationId);
|
|
||||||
}, false)
|
|
||||||
|
|
||||||
initiateUI();
|
initiateUI();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,11 +88,13 @@
|
|||||||
var initiateUI = function() {
|
var initiateUI = function() {
|
||||||
try {
|
try {
|
||||||
window.JPush.init();
|
window.JPush.init();
|
||||||
window.JPush.setDebugMode(true);
|
|
||||||
window.setTimeout(getRegistrationID, 1000);
|
window.setTimeout(getRegistrationID, 1000);
|
||||||
|
|
||||||
if (device.platform != "Android") {
|
if (device.platform != "Android") {
|
||||||
|
window.JPush.setDebugModeFromIos();
|
||||||
window.JPush.setApplicationIconBadgeNumber(0);
|
window.JPush.setApplicationIconBadgeNumber(0);
|
||||||
|
} else {
|
||||||
|
window.JPush.setDebugMode(true);
|
||||||
|
window.JPush.setStatisticsOpen(true);
|
||||||
}
|
}
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
console.log(exception);
|
console.log(exception);
|
||||||
@@ -122,9 +118,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.JPush.setTags({ sequence: 1, tags: tags },
|
window.JPush.setTags({ sequence: 1, tags: tags },
|
||||||
function (result) {
|
(result) => {
|
||||||
$("#tagsResult").html(result.tags)
|
$("#tagsResult").html(result.tags)
|
||||||
}, function (error) {
|
}, (error) => {
|
||||||
alert(error.code)
|
alert(error.code)
|
||||||
})
|
})
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
@@ -134,19 +130,19 @@
|
|||||||
|
|
||||||
$("#getAllTags").click(function (event) {
|
$("#getAllTags").click(function (event) {
|
||||||
window.JPush.getAllTags({ sequence: 2 },
|
window.JPush.getAllTags({ sequence: 2 },
|
||||||
function (result) {
|
(result) => {
|
||||||
$("#tagsResult").html(result.tags)
|
$("#tagsResult").html(result.tags)
|
||||||
}, function (error) {
|
}, (error) => {
|
||||||
alert(error.code)
|
alert(error.code)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#cleanTags").click(function (event) {
|
$("#cleanTags").click(function (event) {
|
||||||
window.JPush.cleanTags({ sequence: 2 },
|
window.JPush.cleanTags({ sequence: 2 },
|
||||||
function (result) {
|
(result) => {
|
||||||
alert(result.sequence)
|
alert(result.sequence)
|
||||||
$("#tagsResult").html("")
|
$("#tagsResult").html("")
|
||||||
}, function (error) {
|
}, (error) => {
|
||||||
alert(error.code)
|
alert(error.code)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -154,27 +150,27 @@
|
|||||||
$("#setAlias").click(function (event) {
|
$("#setAlias").click(function (event) {
|
||||||
var alias = $("#aliasText").val()
|
var alias = $("#aliasText").val()
|
||||||
window.JPush.setAlias({ sequence: 1, alias: alias },
|
window.JPush.setAlias({ sequence: 1, alias: alias },
|
||||||
function (result) {
|
(result) => {
|
||||||
$("#aliasResult").html(result.alias)
|
$("#aliasResult").html(result.alias)
|
||||||
}, function (error){
|
}, (error) => {
|
||||||
alert(error.code)
|
alert(error.code)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#getAlias").click(function (event) {
|
$("#getAlias").click(function (event) {
|
||||||
window.JPush.getAlias({ sequence: 2 },
|
window.JPush.getAlias({ sequence: 2 },
|
||||||
function (result) {
|
(result) => {
|
||||||
alert(JSON.stringify(result));
|
alert(JSON.stringify(result));
|
||||||
}, function (error) {
|
}, (error) => {
|
||||||
alert(error.code)
|
alert(error.code)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#deleteAlias").click(function (event) {
|
$("#deleteAlias").click(function (event) {
|
||||||
window.JPush.deleteAlias({ sequence: 3 },
|
window.JPush.deleteAlias({ sequence: 3 },
|
||||||
function (result) {
|
(result) => {
|
||||||
alert(JSON.stringify(result));
|
alert(JSON.stringify(result));
|
||||||
}, function (error) {
|
}, (error) => {
|
||||||
alert(error.code)
|
alert(error.code)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
@@ -1,25 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import { Platform } from 'ionic-angular';
|
|
||||||
import { StatusBar } from '@ionic-native/status-bar';
|
|
||||||
import { SplashScreen } from '@ionic-native/splash-screen';
|
|
||||||
import { JPush } from '@jiguang-ionic/jpush';
|
|
||||||
|
|
||||||
import { HomePage } from '../pages/home/home';
|
|
||||||
@Component({
|
|
||||||
templateUrl: 'app.html'
|
|
||||||
})
|
|
||||||
export class MyApp {
|
|
||||||
rootPage:any = HomePage;
|
|
||||||
|
|
||||||
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, jpush: JPush) {
|
|
||||||
platform.ready().then(() => {
|
|
||||||
// Okay, so the platform is ready and our plugins are available.
|
|
||||||
// Here you can do any higher level native things you might need.
|
|
||||||
statusBar.styleDefault();
|
|
||||||
splashScreen.hide();
|
|
||||||
|
|
||||||
jpush.init();
|
|
||||||
jpush.setDebugMode(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
<ion-nav [root]="rootPage"></ion-nav>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
|
||||||
import { ErrorHandler, NgModule } from '@angular/core';
|
|
||||||
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
|
|
||||||
import { SplashScreen } from '@ionic-native/splash-screen';
|
|
||||||
import { StatusBar } from '@ionic-native/status-bar';
|
|
||||||
import { Device } from '@ionic-native/device';
|
|
||||||
import { JPush } from '@jiguang-ionic/jpush';
|
|
||||||
|
|
||||||
import { MyApp } from './app.component';
|
|
||||||
import { HomePage } from '../pages/home/home';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
MyApp,
|
|
||||||
HomePage
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
BrowserModule,
|
|
||||||
IonicModule.forRoot(MyApp)
|
|
||||||
],
|
|
||||||
bootstrap: [IonicApp],
|
|
||||||
entryComponents: [
|
|
||||||
MyApp,
|
|
||||||
HomePage
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
StatusBar,
|
|
||||||
SplashScreen,
|
|
||||||
Device,
|
|
||||||
JPush,
|
|
||||||
{provide: ErrorHandler, useClass: IonicErrorHandler}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class AppModule {}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<ion-header>
|
|
||||||
<ion-navbar>
|
|
||||||
<ion-title>
|
|
||||||
JPush Ionic Example
|
|
||||||
</ion-title>
|
|
||||||
</ion-navbar>
|
|
||||||
</ion-header>
|
|
||||||
|
|
||||||
<ion-content padding>
|
|
||||||
|
|
||||||
<ion-list>
|
|
||||||
<ion-item>
|
|
||||||
<div>Registration Id: {{registrationId}}</div>
|
|
||||||
<button ion-button full (click)="getRegistrationID()">Get Registration Id</button>
|
|
||||||
</ion-item>
|
|
||||||
|
|
||||||
<ion-item>
|
|
||||||
<button ion-button full (click)="setTags()">Set tags - Tag1, Tag2</button>
|
|
||||||
<button ion-button full (click)="addTags()">Add tags - Tag3, Tag4</button>
|
|
||||||
<button ion-button full (click)="checkTagBindState()">Check tag bind state - Tag1</button>
|
|
||||||
<button ion-button full (click)="deleteTags()">Delete tags - Tag4</button>
|
|
||||||
<button ion-button full (click)="getAllTags()">Get all tags</button>
|
|
||||||
<button ion-button full (click)="cleanTags()">Clean tags</button>
|
|
||||||
</ion-item>
|
|
||||||
|
|
||||||
<ion-item>
|
|
||||||
<button ion-button full (click)="setAlias()">Set Alias - TestAlias</button>
|
|
||||||
<button ion-button full (click)="getAlias()">Get Alias</button>
|
|
||||||
<button ion-button full (click)="deleteAlias()">Delete Alias</button>
|
|
||||||
</ion-item>
|
|
||||||
|
|
||||||
<ion-item>
|
|
||||||
<button ion-button full (click)="addLocalNotification()">Trigger local notification after 5 seconds</button>
|
|
||||||
</ion-item>
|
|
||||||
</ion-list>
|
|
||||||
</ion-content>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
page-home {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import { NavController } from 'ionic-angular';
|
|
||||||
import { JPush } from '@jiguang-ionic/jpush';
|
|
||||||
import { Device } from '@ionic-native/device';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'page-home',
|
|
||||||
templateUrl: 'home.html'
|
|
||||||
})
|
|
||||||
export class HomePage {
|
|
||||||
|
|
||||||
public registrationId: string;
|
|
||||||
|
|
||||||
devicePlatform: string;
|
|
||||||
sequence: number = 0;
|
|
||||||
|
|
||||||
tagResultHandler = function(result) {
|
|
||||||
var sequence: number = result.sequence;
|
|
||||||
var tags: Array<string> = result.tags == null ? [] : result.tags;
|
|
||||||
alert('Success!' + '\nSequence: ' + sequence + '\nTags: ' + tags.toString());
|
|
||||||
};
|
|
||||||
|
|
||||||
aliasResultHandler = function(result) {
|
|
||||||
var sequence: number = result.sequence;
|
|
||||||
var alias: string = result.alias;
|
|
||||||
alert('Success!' + '\nSequence: ' + sequence + '\nAlias: ' + alias);
|
|
||||||
};
|
|
||||||
|
|
||||||
errorHandler = function(err) {
|
|
||||||
var sequence: number = err.sequence;
|
|
||||||
var code = err.code;
|
|
||||||
alert('Error!' + '\nSequence: ' + sequence + '\nCode: ' + code);
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(public navCtrl: NavController, public jpush: JPush, device: Device) {
|
|
||||||
|
|
||||||
this.devicePlatform = device.platform;
|
|
||||||
|
|
||||||
document.addEventListener('jpush.receiveNotification', (event: any) => {
|
|
||||||
var content;
|
|
||||||
if (this.devicePlatform == 'Android') {
|
|
||||||
content = event.alert;
|
|
||||||
} else {
|
|
||||||
content = event.aps.alert;
|
|
||||||
}
|
|
||||||
alert('Receive notification: ' + JSON.stringify(event));
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
document.addEventListener('jpush.openNotification', (event: any) => {
|
|
||||||
var content;
|
|
||||||
if (this.devicePlatform == 'Android') {
|
|
||||||
content = event.alert;
|
|
||||||
} else { // iOS
|
|
||||||
if (event.aps == undefined) { // 本地通知
|
|
||||||
content = event.content;
|
|
||||||
} else { // APNS
|
|
||||||
content = event.aps.alert;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
alert('open notification: ' + JSON.stringify(event));
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
document.addEventListener('jpush.receiveLocalNotification', (event: any) => {
|
|
||||||
// iOS(*,9) Only , iOS(10,*) 将在 jpush.openNotification 和 jpush.receiveNotification 中触发。
|
|
||||||
var content;
|
|
||||||
if (this.devicePlatform == 'Android') {
|
|
||||||
} else {
|
|
||||||
content = event.content;
|
|
||||||
}
|
|
||||||
alert('receive local notification: ' + JSON.stringify(event));
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
getRegistrationID() {
|
|
||||||
this.jpush.getRegistrationID()
|
|
||||||
.then(rId => {
|
|
||||||
this.registrationId = rId;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setTags() {
|
|
||||||
this.jpush.setTags({ sequence: this.sequence++, tags: ['Tag1', 'Tag2']})
|
|
||||||
.then(this.tagResultHandler)
|
|
||||||
.catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
addTags() {
|
|
||||||
this.jpush.addTags({ sequence: this.sequence++, tags: ['Tag3', 'Tag4']})
|
|
||||||
.then(this.tagResultHandler)
|
|
||||||
.catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
checkTagBindState() {
|
|
||||||
this.jpush.checkTagBindState({ sequence: this.sequence++, tag: 'Tag1' })
|
|
||||||
.then(result => {
|
|
||||||
var sequence = result.sequence;
|
|
||||||
var tag = result.tag;
|
|
||||||
var isBind = result.isBind;
|
|
||||||
alert('Sequence: ' + sequence + '\nTag: ' + tag + '\nIsBind: ' + isBind);
|
|
||||||
}).catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteTags() {
|
|
||||||
this.jpush.deleteTags({ sequence: this.sequence++, tags: ['Tag4']})
|
|
||||||
.then(this.tagResultHandler)
|
|
||||||
.catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
getAllTags() {
|
|
||||||
this.jpush.getAllTags({ sequence: this.sequence++ })
|
|
||||||
.then(this.tagResultHandler)
|
|
||||||
.catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanTags() {
|
|
||||||
this.jpush.cleanTags({ sequence: this.sequence++ })
|
|
||||||
.then(this.tagResultHandler)
|
|
||||||
.catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
setAlias() {
|
|
||||||
this.jpush.setAlias({ sequence: this.sequence++, alias: 'TestAlias' })
|
|
||||||
.then(this.aliasResultHandler)
|
|
||||||
.catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
getAlias() {
|
|
||||||
this.jpush.getAlias({ sequence: this.sequence++ })
|
|
||||||
.then(this.aliasResultHandler)
|
|
||||||
.catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteAlias() {
|
|
||||||
this.jpush.deleteAlias({ sequence: this.sequence++ })
|
|
||||||
.then(this.aliasResultHandler)
|
|
||||||
.catch(this.errorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
addLocalNotification() {
|
|
||||||
if (this.devicePlatform == 'Android') {
|
|
||||||
this.jpush.addLocalNotification(0, 'Hello JPush', 'JPush', 1, 5000);
|
|
||||||
} else {
|
|
||||||
this.jpush.addLocalNotificationForIOS(5, 'Hello JPush', 1, 'localNoti1');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-171
@@ -1,171 +0,0 @@
|
|||||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
|
|
||||||
export interface TagOptions {
|
|
||||||
sequence: number;
|
|
||||||
tags?: Array<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AliasOptions {
|
|
||||||
sequence: number;
|
|
||||||
alias?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Plugin({
|
|
||||||
pluginName: 'JPush',
|
|
||||||
plugin: 'jpush-phonegap-plugin',
|
|
||||||
pluginRef: 'plugins.jPushPlugin',
|
|
||||||
repo: 'https://github.com/jpush/jpush-phonegap-plugin',
|
|
||||||
install: 'ionic cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_app_key',
|
|
||||||
installVariables: ['APP_KEY'],
|
|
||||||
platforms: ['Android', 'iOS']
|
|
||||||
})
|
|
||||||
@Injectable()
|
|
||||||
export class JPush extends IonicNativePlugin {
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
init(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setDebugMode(enable: boolean): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
getRegistrationID(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
stopPush(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
resumePush(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
isPushStopped(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setTags(params: TagOptions): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
addTags(params: TagOptions): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
deleteTags(params: TagOptions): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
cleanTags(params: TagOptions): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
getAllTags(params: TagOptions): Promise<any> { return; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param params { sequence: number, tag: string }
|
|
||||||
*/
|
|
||||||
@Cordova()
|
|
||||||
checkTagBindState(params: object): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setAlias(params: AliasOptions): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
deleteAlias(params: AliasOptions): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
getAlias(params: AliasOptions): Promise<any> { return; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determinate whether the application notification has been opened.
|
|
||||||
*
|
|
||||||
* iOS: 0: closed; >1: opened.
|
|
||||||
* UIRemoteNotificationTypeNone = 0,
|
|
||||||
* UIRemoteNotificationTypeBadge = 1 << 0,
|
|
||||||
* UIRemoteNotificationTypeSound = 1 << 1,
|
|
||||||
* UIRemoteNotificationTypeAlert = 1 << 2,
|
|
||||||
* UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3
|
|
||||||
*
|
|
||||||
* Android: 0: closed; 1: opened.
|
|
||||||
*/
|
|
||||||
@Cordova()
|
|
||||||
getUserNotificationSettings(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
clearLocalNotifications(): Promise<any> { return; }
|
|
||||||
|
|
||||||
// iOS API - start
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setBadge(badge: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
resetBadge(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setApplicationIconBadgeNumber(badge: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
getApplicationIconBadgeNumber(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
addDismissActions(actions: Array<object>, categoryId: string): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
addNotificationActions(actions: Array<object>, categoryId: string): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setLocation(latitude: number, longitude: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
startLogPageView(pageName: string): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
stopLogPageView(pageName: string): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
beginLogPageView(pageName: string, duration: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
// iOS API - end
|
|
||||||
|
|
||||||
// Android API - start
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
getConnectionState(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setBasicPushNotificationBuilder(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setCustomPushNotificationBuilder(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
clearAllNotification(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
clearNotificationById(id: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setLatestNotificationNum(num: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
addLocalNotification(builderId: number, content: string, title: string, notificationId: number, broadcastTime: number, extras?: string): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
removeLocalNotification(notificationId: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
reportNotificationOpened(msgId: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
requestPermission(): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
@Cordova()
|
|
||||||
setPushTime(weekdays: Array<string>, startHour: number, endHour: number): Promise<any> { return; }
|
|
||||||
|
|
||||||
// Android API - end
|
|
||||||
}
|
|
||||||
Vendored
-67
@@ -1,67 +0,0 @@
|
|||||||
import { IonicNativePlugin } from '@ionic-native/core';
|
|
||||||
export interface TagOptions {
|
|
||||||
sequence: number;
|
|
||||||
tags?: Array<string>;
|
|
||||||
}
|
|
||||||
export interface AliasOptions {
|
|
||||||
sequence: number;
|
|
||||||
alias?: string;
|
|
||||||
}
|
|
||||||
export declare class JPush extends IonicNativePlugin {
|
|
||||||
init(): Promise<any>;
|
|
||||||
setDebugMode(enable: boolean): Promise<any>;
|
|
||||||
getRegistrationID(): Promise<any>;
|
|
||||||
stopPush(): Promise<any>;
|
|
||||||
resumePush(): Promise<any>;
|
|
||||||
isPushStopped(): Promise<any>;
|
|
||||||
setTags(params: TagOptions): Promise<any>;
|
|
||||||
addTags(params: TagOptions): Promise<any>;
|
|
||||||
deleteTags(params: TagOptions): Promise<any>;
|
|
||||||
cleanTags(params: TagOptions): Promise<any>;
|
|
||||||
getAllTags(params: TagOptions): Promise<any>;
|
|
||||||
/**
|
|
||||||
* @param params { sequence: number, tag: string }
|
|
||||||
*/
|
|
||||||
checkTagBindState(params: object): Promise<any>;
|
|
||||||
setAlias(params: AliasOptions): Promise<any>;
|
|
||||||
deleteAlias(params: AliasOptions): Promise<any>;
|
|
||||||
getAlias(params: AliasOptions): Promise<any>;
|
|
||||||
/**
|
|
||||||
* Determinate whether the application notification has been opened.
|
|
||||||
*
|
|
||||||
* iOS: 0: closed; >1: opened.
|
|
||||||
* UIRemoteNotificationTypeNone = 0,
|
|
||||||
* UIRemoteNotificationTypeBadge = 1 << 0,
|
|
||||||
* UIRemoteNotificationTypeSound = 1 << 1,
|
|
||||||
* UIRemoteNotificationTypeAlert = 1 << 2,
|
|
||||||
* UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3
|
|
||||||
*
|
|
||||||
* Android: 0: closed; 1: opened.
|
|
||||||
*/
|
|
||||||
getUserNotificationSettings(): Promise<any>;
|
|
||||||
clearLocalNotifications(): Promise<any>;
|
|
||||||
setBadge(badge: number): Promise<any>;
|
|
||||||
resetBadge(): Promise<any>;
|
|
||||||
setApplicationIconBadgeNumber(badge: number): Promise<any>;
|
|
||||||
getApplicationIconBadgeNumber(): Promise<any>;
|
|
||||||
addLocalNotificationForIOS(delayTime: number, content: string, badge: number, identifierKey: string, extras?: object): Promise<any>;
|
|
||||||
deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): Promise<any>;
|
|
||||||
addDismissActions(actions: Array<object>, categoryId: string): Promise<any>;
|
|
||||||
addNotificationActions(actions: Array<object>, categoryId: string): Promise<any>;
|
|
||||||
setLocation(latitude: number, longitude: number): Promise<any>;
|
|
||||||
startLogPageView(pageName: string): Promise<any>;
|
|
||||||
stopLogPageView(pageName: string): Promise<any>;
|
|
||||||
beginLogPageView(pageName: string, duration: number): Promise<any>;
|
|
||||||
getConnectionState(): Promise<any>;
|
|
||||||
setBasicPushNotificationBuilder(): Promise<any>;
|
|
||||||
setCustomPushNotificationBuilder(): Promise<any>;
|
|
||||||
clearAllNotification(): Promise<any>;
|
|
||||||
clearNotificationById(id: number): Promise<any>;
|
|
||||||
setLatestNotificationNum(num: number): Promise<any>;
|
|
||||||
addLocalNotification(builderId: number, content: string, title: string, notificationId: number, broadcastTime: number, extras?: string): Promise<any>;
|
|
||||||
removeLocalNotification(notificationId: number): Promise<any>;
|
|
||||||
reportNotificationOpened(msgId: number): Promise<any>;
|
|
||||||
requestPermission(): Promise<any>;
|
|
||||||
setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise<any>;
|
|
||||||
setPushTime(weekdays: Array<string>, startHour: number, endHour: number): Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -1,352 +0,0 @@
|
|||||||
var __extends = (this && this.__extends) || (function () {
|
|
||||||
var extendStatics = Object.setPrototypeOf ||
|
|
||||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
||||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
||||||
return function (d, b) {
|
|
||||||
extendStatics(d, b);
|
|
||||||
function __() { this.constructor = d; }
|
|
||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
||||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
||||||
};
|
|
||||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
var JPush = (function (_super) {
|
|
||||||
__extends(JPush, _super);
|
|
||||||
function JPush() {
|
|
||||||
return _super !== null && _super.apply(this, arguments) || this;
|
|
||||||
}
|
|
||||||
JPush.prototype.init = function () { return; };
|
|
||||||
JPush.prototype.setDebugMode = function (enable) { return; };
|
|
||||||
JPush.prototype.getRegistrationID = function () { return; };
|
|
||||||
JPush.prototype.stopPush = function () { return; };
|
|
||||||
JPush.prototype.resumePush = function () { return; };
|
|
||||||
JPush.prototype.isPushStopped = function () { return; };
|
|
||||||
JPush.prototype.setTags = function (params) { return; };
|
|
||||||
JPush.prototype.addTags = function (params) { return; };
|
|
||||||
JPush.prototype.deleteTags = function (params) { return; };
|
|
||||||
JPush.prototype.cleanTags = function (params) { return; };
|
|
||||||
JPush.prototype.getAllTags = function (params) { return; };
|
|
||||||
/**
|
|
||||||
* @param params { sequence: number, tag: string }
|
|
||||||
*/
|
|
||||||
JPush.prototype.checkTagBindState = function (params) { return; };
|
|
||||||
JPush.prototype.setAlias = function (params) { return; };
|
|
||||||
JPush.prototype.deleteAlias = function (params) { return; };
|
|
||||||
JPush.prototype.getAlias = function (params) { return; };
|
|
||||||
/**
|
|
||||||
* Determinate whether the application notification has been opened.
|
|
||||||
*
|
|
||||||
* iOS: 0: closed; >1: opened.
|
|
||||||
* UIRemoteNotificationTypeNone = 0,
|
|
||||||
* UIRemoteNotificationTypeBadge = 1 << 0,
|
|
||||||
* UIRemoteNotificationTypeSound = 1 << 1,
|
|
||||||
* UIRemoteNotificationTypeAlert = 1 << 2,
|
|
||||||
* UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3
|
|
||||||
*
|
|
||||||
* Android: 0: closed; 1: opened.
|
|
||||||
*/
|
|
||||||
JPush.prototype.getUserNotificationSettings = function () { return; };
|
|
||||||
JPush.prototype.clearLocalNotifications = function () { return; };
|
|
||||||
// iOS API - start
|
|
||||||
JPush.prototype.setBadge = function (badge) { return; };
|
|
||||||
JPush.prototype.resetBadge = function () { return; };
|
|
||||||
JPush.prototype.setApplicationIconBadgeNumber = function (badge) { return; };
|
|
||||||
JPush.prototype.getApplicationIconBadgeNumber = function () { return; };
|
|
||||||
JPush.prototype.addLocalNotificationForIOS = function (delayTime, content, badge, identifierKey, extras) { return; };
|
|
||||||
JPush.prototype.deleteLocalNotificationWithIdentifierKeyInIOS = function (identifierKey) { return; };
|
|
||||||
JPush.prototype.addDismissActions = function (actions, categoryId) { return; };
|
|
||||||
JPush.prototype.addNotificationActions = function (actions, categoryId) { return; };
|
|
||||||
JPush.prototype.setLocation = function (latitude, longitude) { return; };
|
|
||||||
JPush.prototype.startLogPageView = function (pageName) { return; };
|
|
||||||
JPush.prototype.stopLogPageView = function (pageName) { return; };
|
|
||||||
JPush.prototype.beginLogPageView = function (pageName, duration) { return; };
|
|
||||||
// iOS API - end
|
|
||||||
// Android API - start
|
|
||||||
JPush.prototype.getConnectionState = function () { return; };
|
|
||||||
JPush.prototype.setBasicPushNotificationBuilder = function () { return; };
|
|
||||||
JPush.prototype.setCustomPushNotificationBuilder = function () { return; };
|
|
||||||
JPush.prototype.clearAllNotification = function () { return; };
|
|
||||||
JPush.prototype.clearNotificationById = function (id) { return; };
|
|
||||||
JPush.prototype.setLatestNotificationNum = function (num) { return; };
|
|
||||||
JPush.prototype.addLocalNotification = function (builderId, content, title, notificationId, broadcastTime, extras) { return; };
|
|
||||||
JPush.prototype.removeLocalNotification = function (notificationId) { return; };
|
|
||||||
JPush.prototype.reportNotificationOpened = function (msgId) { return; };
|
|
||||||
JPush.prototype.requestPermission = function () { return; };
|
|
||||||
JPush.prototype.setSilenceTime = function (startHour, startMinute, endHour, endMinute) { return; };
|
|
||||||
JPush.prototype.setPushTime = function (weekdays, startHour, endHour) { return; };
|
|
||||||
// Android API - end
|
|
||||||
JPush.decorators = [
|
|
||||||
{ type: Injectable },
|
|
||||||
];
|
|
||||||
/** @nocollapse */
|
|
||||||
JPush.ctorParameters = function () { return []; };
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "init", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Boolean]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setDebugMode", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "getRegistrationID", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "stopPush", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "resumePush", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "isPushStopped", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setTags", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "addTags", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "deleteTags", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "cleanTags", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "getAllTags", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "checkTagBindState", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setAlias", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "deleteAlias", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "getAlias", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "getUserNotificationSettings", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "clearLocalNotifications", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setBadge", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "resetBadge", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setApplicationIconBadgeNumber", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "getApplicationIconBadgeNumber", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number, String, Number, String, Object]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "addLocalNotificationForIOS", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [String]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "deleteLocalNotificationWithIdentifierKeyInIOS", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Array, String]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "addDismissActions", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Array, String]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "addNotificationActions", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number, Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setLocation", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [String]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "startLogPageView", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [String]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "stopLogPageView", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [String, Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "beginLogPageView", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "getConnectionState", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setBasicPushNotificationBuilder", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setCustomPushNotificationBuilder", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "clearAllNotification", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "clearNotificationById", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setLatestNotificationNum", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number, String, String, Number, Number, String]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "addLocalNotification", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "removeLocalNotification", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "reportNotificationOpened", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", []),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "requestPermission", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Number, Number, Number, Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setSilenceTime", null);
|
|
||||||
__decorate([
|
|
||||||
Cordova(),
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Array, Number, Number]),
|
|
||||||
__metadata("design:returntype", Promise)
|
|
||||||
], JPush.prototype, "setPushTime", null);
|
|
||||||
JPush = __decorate([
|
|
||||||
Plugin({
|
|
||||||
pluginName: 'JPush',
|
|
||||||
plugin: 'jpush-phonegap-plugin',
|
|
||||||
pluginRef: 'plugins.jPushPlugin',
|
|
||||||
repo: 'https://github.com/jpush/jpush-phonegap-plugin',
|
|
||||||
install: 'ionic cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_app_key',
|
|
||||||
installVariables: ['APP_KEY'],
|
|
||||||
platforms: ['Android', 'iOS']
|
|
||||||
})
|
|
||||||
], JPush);
|
|
||||||
return JPush;
|
|
||||||
}(IonicNativePlugin));
|
|
||||||
export { JPush };
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@jiguang-ionic/jpush",
|
|
||||||
"version": "1.0.2",
|
|
||||||
"description": "JPush support for ionic-native",
|
|
||||||
"module": "index.js",
|
|
||||||
"typings": "index.d.ts",
|
|
||||||
"author": "hevin",
|
|
||||||
"license": "MIT",
|
|
||||||
"peerDependencies": {
|
|
||||||
"@ionic-native/core": "^4.2.0",
|
|
||||||
"@angular/core": "*",
|
|
||||||
"rxjs": "^5.0.1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/jpush/jpush-phonegap-plugin"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
**WARNING: 如果不按照这个表格,我们将无法帮助你,并将忽略你的问题。**
|
|
||||||
|
|
||||||
## 你的运行环境
|
|
||||||
|
|
||||||
* 插件版本:
|
|
||||||
* 平台(Android / iOS):
|
|
||||||
* Cordova version (```cordova -v```):
|
|
||||||
* Cordova platform version (```cordova platform ls```):
|
|
||||||
* Ionic Version (if using Ionic)
|
|
||||||
|
|
||||||
## 期望效果
|
|
||||||
|
|
||||||
告诉我们你希望达到什么效果。
|
|
||||||
|
|
||||||
## 实际效果
|
|
||||||
|
|
||||||
告诉我们实际是什么效果。
|
|
||||||
|
|
||||||
## 重现步骤
|
|
||||||
|
|
||||||
1. ...
|
|
||||||
2. ...
|
|
||||||
3. ...
|
|
||||||
4. ...
|
|
||||||
|
|
||||||
## 背景
|
|
||||||
|
|
||||||
你尝试做过些什么?
|
|
||||||
|
|
||||||
## Debug logs
|
|
||||||
|
|
||||||
包括 Android 或 iOS 的日志:
|
|
||||||
|
|
||||||
* iOS: XCode logs
|
|
||||||
* Android: $ adb logcat / Android Studio logcat
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jpush-phonegap-plugin",
|
"name": "jpush-phonegap-plugin",
|
||||||
"version": "3.3.2",
|
"version": "3.2.8",
|
||||||
"description": "JPush for cordova plugin",
|
"description": "JPush for cordova plugin",
|
||||||
"cordova": {
|
"cordova": {
|
||||||
"id": "jpush-phonegap-plugin",
|
"id": "jpush-phonegap-plugin",
|
||||||
|
|||||||
+17
-6
@@ -2,7 +2,7 @@
|
|||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
id="jpush-phonegap-plugin"
|
id="jpush-phonegap-plugin"
|
||||||
version="3.3.2">
|
version="3.2.8">
|
||||||
|
|
||||||
<name>JPush</name>
|
<name>JPush</name>
|
||||||
<description>JPush for cordova plugin</description>
|
<description>JPush for cordova plugin</description>
|
||||||
@@ -161,14 +161,25 @@
|
|||||||
|
|
||||||
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="cn.jiguang.cordova.push.JPushReceiver"
|
android:name="cn.jiguang.cordova.push.MyReceiver"
|
||||||
android:enabled="true">
|
android:enabled="true">
|
||||||
|
<intent-filter android:priority="1000">
|
||||||
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
|
||||||
|
<!-- Required 显示通知栏 -->
|
||||||
|
<category android:name="$PACKAGE_NAME" />
|
||||||
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="cn.jpush.android.intent.REGISTRATION" />
|
<action android:name="cn.jpush.android.intent.REGISTRATION" />
|
||||||
|
<!-- Required 用户注册SDK的intent -->
|
||||||
|
<action android:name="cn.jpush.android.intent.UNREGISTRATION" />
|
||||||
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
|
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
|
||||||
|
<!-- Required 用户接收SDK消息的intent -->
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
|
||||||
|
<!-- Required 用户接收SDK通知栏信息的intent -->
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
|
||||||
<action android:name="cn.jpush.android.intent.CONNECTION" />
|
<!-- Required 用户打开自定义通知栏的intent -->
|
||||||
|
<action android:name="cn.jpush.android.intent.ACTION_RICHPUSH_CALLBACK" />
|
||||||
|
<!-- Optional 用户接受Rich Push Javascript 回调函数的intent -->
|
||||||
<category android:name="$PACKAGE_NAME" />
|
<category android:name="$PACKAGE_NAME" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
@@ -187,7 +198,7 @@
|
|||||||
<receiver android:name="cn.jiguang.cordova.push.JPushEventReceiver">
|
<receiver android:name="cn.jiguang.cordova.push.JPushEventReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
||||||
<category android:name="$PACKAGE_NAME" />
|
<category android:name="$PACKAGE_NAME"></category>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
@@ -196,9 +207,9 @@
|
|||||||
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
|
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<source-file src="src/android/libs/jpush-android-3.1.1.jar" target-dir="libs" />
|
<source-file src="src/android/libs/jpush-android-3.0.9.jar" target-dir="libs" />
|
||||||
|
|
||||||
<source-file src="src/android/JPushReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
|
<source-file src="src/android/MyReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||||
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
|
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||||
<source-file src="src/android/JPushEventReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
|
<source-file src="src/android/JPushEventReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ public class JPushEventReceiver extends JPushMessageReceiver {
|
|||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
callback.success(resultJson);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -104,6 +103,7 @@ public class JPushEventReceiver extends JPushMessageReceiver {
|
|||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
callback.error(resultJson);
|
callback.error(resultJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import cn.jpush.android.api.JPushInterface;
|
import cn.jpush.android.api.JPushInterface;
|
||||||
|
|
||||||
public class JPushReceiver extends BroadcastReceiver {
|
public class MyReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
private static final List<String> IGNORED_EXTRAS_KEYS =
|
private static final List<String> IGNORED_EXTRAS_KEYS =
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
@@ -56,14 +56,17 @@ public class JPushReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
Intent launch = context.getPackageManager().getLaunchIntentForPackage(
|
Intent launch = context.getPackageManager().getLaunchIntentForPackage(
|
||||||
context.getPackageName());
|
context.getPackageName());
|
||||||
if (launch != null) {
|
launch.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
launch.addCategory(Intent.CATEGORY_LAUNCHER);
|
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
context.startActivity(launch);
|
||||||
context.startActivity(launch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handlingNotificationReceive(Context context, Intent intent) {
|
private void handlingNotificationReceive(Context context, Intent intent) {
|
||||||
|
Intent launch = context.getPackageManager().getLaunchIntentForPackage(
|
||||||
|
context.getPackageName());
|
||||||
|
launch.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
|
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
|
||||||
String title = intent.getStringExtra(JPushInterface.EXTRA_NOTIFICATION_TITLE);
|
String title = intent.getStringExtra(JPushInterface.EXTRA_NOTIFICATION_TITLE);
|
||||||
JPushPlugin.notificationTitle = title;
|
JPushPlugin.notificationTitle = title;
|
||||||
|
|
||||||
Executable
BIN
Binary file not shown.
Binary file not shown.
@@ -28,24 +28,25 @@
|
|||||||
return [self init_plus];
|
return [self init_plus];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)fireOpenNotification:(NSTimer*)timer{
|
||||||
|
if (SharedJPushPlugin) {
|
||||||
|
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[timer.userInfo toJsonString]];
|
||||||
|
[timer invalidate];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NSDictionary *_launchOptions;
|
NSDictionary *_launchOptions;
|
||||||
-(void)applicationDidLaunch:(NSNotification *)notification{
|
-(void)applicationDidLaunch:(NSNotification *)notification{
|
||||||
|
|
||||||
if (!_jpushEventCache) {
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jpushSDKDidLoginNotification) name:kJPFNetworkDidLoginNotification object:nil];
|
||||||
_jpushEventCache = @{}.mutableCopy;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JPUSHService registrationIDCompletionHandler:^(int resCode, NSString *registrationID) {
|
|
||||||
NSDictionary *event = @{@"registrationId": registrationID?:@""};
|
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]];
|
|
||||||
}];
|
|
||||||
|
|
||||||
if (notification) {
|
if (notification) {
|
||||||
if (notification.userInfo) {
|
if (notification.userInfo) {
|
||||||
|
|
||||||
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
|
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification
|
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:)
|
||||||
jsString:[[self jpushFormatAPNSDic: notification.userInfo[UIApplicationLaunchOptionsRemoteNotificationKey]] toJsonString]];
|
userInfo:[notification.userInfo
|
||||||
|
valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey] repeats:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]) {
|
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]) {
|
||||||
@@ -55,7 +56,7 @@ NSDictionary *_launchOptions;
|
|||||||
@"badge": @(localNotification.applicationIconBadgeNumber),
|
@"badge": @(localNotification.applicationIconBadgeNumber),
|
||||||
@"extras":localNotification.userInfo,
|
@"extras":localNotification.userInfo,
|
||||||
};
|
};
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[localNotificationEvent toJsonString]];
|
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:localNotificationEvent repeats:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,23 +84,6 @@ NSDictionary *_launchOptions;
|
|||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]];
|
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMutableDictionary *)jpushFormatAPNSDic:(NSDictionary *)dic {
|
|
||||||
NSMutableDictionary *extras = @{}.mutableCopy;
|
|
||||||
for (NSString *key in dic) {
|
|
||||||
if([key isEqualToString:@"_j_business"] ||
|
|
||||||
[key isEqualToString:@"_j_msgid"] ||
|
|
||||||
[key isEqualToString:@"_j_uid"] ||
|
|
||||||
[key isEqualToString:@"actionIdentifier"] ||
|
|
||||||
[key isEqualToString:@"aps"]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
extras[key] = dic[key];
|
|
||||||
}
|
|
||||||
NSMutableDictionary *formatDic = dic.mutableCopy;
|
|
||||||
formatDic[@"extras"] = extras;
|
|
||||||
return formatDic;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void)registerForRemoteNotification{
|
-(void)registerForRemoteNotification{
|
||||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
|
if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
|
||||||
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
|
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
|
||||||
@@ -148,63 +132,30 @@ NSDictionary *_launchOptions;
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
[JPushPlugin fireDocumentEvent:eventName jsString:[userInfo toJsonString]];
|
||||||
[JPushPlugin fireDocumentEvent:eventName jsString:[[self jpushFormatAPNSDic:userInfo] toJsonString]];
|
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
completionHandler(UIBackgroundFetchResultNewData);
|
completionHandler(UIBackgroundFetchResultNewData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{
|
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{
|
||||||
NSMutableDictionary *userInfo = @{}.mutableCopy;
|
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:notification.request.content.userInfo];
|
||||||
|
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
|
||||||
if ([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
|
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
|
||||||
userInfo = [self jpushFormatAPNSDic:notification.request.content.userInfo];
|
|
||||||
} else {
|
|
||||||
UNNotificationContent *content = notification.request.content;
|
|
||||||
userInfo = [NSMutableDictionary dictionaryWithDictionary:@{@"content": content.body,
|
|
||||||
@"badge": content.badge,
|
|
||||||
@"extras": content.userInfo
|
|
||||||
}];
|
|
||||||
userInfo[@"identifier"] = notification.request.identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
|
|
||||||
|
|
||||||
if ([userInfo[@"aps"][@"content-available"] isEqualToNumber:@(1)]) {// content-available 当用户开启后台推送是,防止触发两次事件
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler{
|
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler{
|
||||||
UNNotification *notification = response.notification;
|
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:response.notification.request.content.userInfo];
|
||||||
NSMutableDictionary *userInfo = nil;
|
@try {
|
||||||
|
[userInfo setValue:[response valueForKey:@"userText"] forKey:@"userText"];
|
||||||
if ([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
|
} @catch (NSException *exception) { }
|
||||||
userInfo = [self jpushFormatAPNSDic:notification.request.content.userInfo];
|
[userInfo setValue:response.actionIdentifier forKey:@"actionIdentifier"];
|
||||||
} else {
|
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[userInfo toJsonString]];
|
||||||
UNNotificationContent *content = notification.request.content;
|
completionHandler();
|
||||||
userInfo = [NSMutableDictionary dictionaryWithDictionary:@{@"content": content.body,
|
|
||||||
@"badge": content.badge,
|
|
||||||
@"extras": content.userInfo
|
|
||||||
}];
|
|
||||||
userInfo[@"identifier"] = notification.request.identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[userInfo toJsonString]];
|
|
||||||
completionHandler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
|
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
|
||||||
NSDictionary* localNotificationEvent = @{@"content":notification.alertBody,
|
[[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:notification.userInfo];
|
||||||
@"badge": @(notification.applicationIconBadgeNumber),
|
|
||||||
@"extras":notification.userInfo,
|
|
||||||
};
|
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:localNotificationEvent];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||||
|
|||||||
+100
-102
@@ -1,102 +1,100 @@
|
|||||||
//
|
//
|
||||||
// PushTalkPlugin.h
|
// PushTalkPlugin.h
|
||||||
// PushTalk
|
// PushTalk
|
||||||
//
|
//
|
||||||
// Created by zhangqinghe on 13-12-13.
|
// Created by zhangqinghe on 13-12-13.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <Cordova/CDV.h>
|
#import <Cordova/CDV.h>
|
||||||
|
|
||||||
static NSMutableDictionary *_jpushEventCache;
|
@interface JPushPlugin : CDVPlugin{
|
||||||
|
|
||||||
@interface JPushPlugin : CDVPlugin{
|
}
|
||||||
|
|
||||||
}
|
//注册通知服务并启动 SDK
|
||||||
|
-(void)startJPushSDK:(CDVInvokedUrlCommand*)command;
|
||||||
//注册通知服务并启动 SDK
|
|
||||||
-(void)startJPushSDK:(CDVInvokedUrlCommand*)command;
|
//以下为js中可调用接口
|
||||||
|
//设置标签、别名
|
||||||
//以下为js中可调用接口
|
-(void)setTags:(CDVInvokedUrlCommand*)command;
|
||||||
//设置标签、别名
|
-(void)addTags:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)setTags:(CDVInvokedUrlCommand*)command;
|
-(void)deleteTags:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)addTags:(CDVInvokedUrlCommand*)command;
|
-(void)cleanTags:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)deleteTags:(CDVInvokedUrlCommand*)command;
|
-(void)getAllTags:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)cleanTags:(CDVInvokedUrlCommand*)command;
|
-(void)checkTagBindState:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)getAllTags:(CDVInvokedUrlCommand*)command;
|
|
||||||
-(void)checkTagBindState:(CDVInvokedUrlCommand*)command;
|
-(void)setAlias:(CDVInvokedUrlCommand*)command;
|
||||||
|
-(void)deleteAlias:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)setAlias:(CDVInvokedUrlCommand*)command;
|
-(void)getAlias:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)deleteAlias:(CDVInvokedUrlCommand*)command;
|
|
||||||
-(void)getAlias:(CDVInvokedUrlCommand*)command;
|
//获取 RegistrationID
|
||||||
|
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command;
|
||||||
//获取 RegistrationID
|
|
||||||
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command;
|
//页面统计
|
||||||
|
-(void)startLogPageView:(CDVInvokedUrlCommand*)command;
|
||||||
//页面统计
|
-(void)stopLogPageView:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)startLogPageView:(CDVInvokedUrlCommand*)command;
|
-(void)beginLogPageView:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)stopLogPageView:(CDVInvokedUrlCommand*)command;
|
|
||||||
-(void)beginLogPageView:(CDVInvokedUrlCommand*)command;
|
//设置角标到服务器,服务器下一次发消息时,会设置成这个值
|
||||||
|
//本接口不会改变应用本地的角标值.
|
||||||
//设置角标到服务器,服务器下一次发消息时,会设置成这个值
|
-(void)setBadge:(CDVInvokedUrlCommand*)command;
|
||||||
//本接口不会改变应用本地的角标值.
|
//相当于 [setBadge:0]
|
||||||
-(void)setBadge:(CDVInvokedUrlCommand*)command;
|
-(void)resetBadge:(CDVInvokedUrlCommand*)command;
|
||||||
//相当于 [setBadge:0]
|
|
||||||
-(void)resetBadge:(CDVInvokedUrlCommand*)command;
|
//应用本地的角标值设置/获取
|
||||||
|
-(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
|
||||||
//应用本地的角标值设置/获取
|
-(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
|
|
||||||
-(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
|
//停止与恢复推送
|
||||||
|
-(void)stopPush:(CDVInvokedUrlCommand*)command;
|
||||||
//停止与恢复推送
|
-(void)resumePush:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)stopPush:(CDVInvokedUrlCommand*)command;
|
-(void)isPushStopped:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)resumePush:(CDVInvokedUrlCommand*)command;
|
|
||||||
-(void)isPushStopped:(CDVInvokedUrlCommand*)command;
|
//开关日志
|
||||||
|
-(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command;
|
||||||
//开关日志
|
-(void)setLogOFF:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command;
|
-(void)crashLogON:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)setLogOFF:(CDVInvokedUrlCommand*)command;
|
|
||||||
-(void)crashLogON:(CDVInvokedUrlCommand*)command;
|
//本地推送
|
||||||
|
-(void)setLocalNotification:(CDVInvokedUrlCommand*)command;
|
||||||
//本地推送
|
-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)setLocalNotification:(CDVInvokedUrlCommand*)command;
|
-(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command;
|
|
||||||
-(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command;
|
//地理位置上报 [latitude,longitude]
|
||||||
|
-(void)setLocation:(CDVInvokedUrlCommand*)command;
|
||||||
//地理位置上报 [latitude,longitude]
|
|
||||||
-(void)setLocation:(CDVInvokedUrlCommand*)command;
|
//检查用户的推送设置情况
|
||||||
|
-(void)getUserNotificationSettings:(CDVInvokedUrlCommand*)command;
|
||||||
//检查用户的推送设置情况
|
|
||||||
-(void)getUserNotificationSettings:(CDVInvokedUrlCommand*)command;
|
//ios 10 APIs
|
||||||
|
-(void)addDismissActions:(CDVInvokedUrlCommand*)command;
|
||||||
//ios 10 APIs
|
-(void)addNotificationActions:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)addDismissActions:(CDVInvokedUrlCommand*)command;
|
|
||||||
-(void)addNotificationActions:(CDVInvokedUrlCommand*)command;
|
/*
|
||||||
|
* 以下为js中可监听到的事件
|
||||||
/*
|
* jpush.openNotification 点击推送消息启动或唤醒app
|
||||||
* 以下为js中可监听到的事件
|
* jpush.receiveMessage 收到自定义消息
|
||||||
* jpush.openNotification 点击推送消息启动或唤醒app
|
* jpush.receiveNotification 前台收到推送
|
||||||
* jpush.receiveMessage 收到自定义消息
|
* jpush.backgroundNotification 后台收到推送
|
||||||
* jpush.receiveNotification 前台收到推送
|
*/
|
||||||
* jpush.backgroundNotification 后台收到推送
|
|
||||||
*/
|
# pragma mark - private
|
||||||
|
|
||||||
# pragma mark - private
|
+(void)fireDocumentEvent:(NSString*)eventName jsString:(NSString*)jsString;
|
||||||
|
|
||||||
+(void)fireDocumentEvent:(NSString*)eventName jsString:(NSString*)jsString;
|
+(void)setupJPushSDK:(NSDictionary*)userInfo;
|
||||||
|
|
||||||
+(void)setupJPushSDK:(NSDictionary*)userInfo;
|
@end
|
||||||
|
|
||||||
@end
|
JPushPlugin *SharedJPushPlugin;
|
||||||
|
|
||||||
static JPushPlugin *SharedJPushPlugin;
|
@interface NSDictionary (JPush)
|
||||||
|
-(NSString*)toJsonString;
|
||||||
@interface NSDictionary (JPush)
|
@end
|
||||||
-(NSString*)toJsonString;
|
|
||||||
@end
|
@interface NSString (JPush)
|
||||||
|
-(NSDictionary*)toDictionary;
|
||||||
@interface NSString (JPush)
|
@end
|
||||||
-(NSDictionary*)toDictionary;
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+506
-575
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user