mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-04-19 00:03:45 +08:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8dba1a4c5e | |||
| d7fc0d2248 | |||
| 66729b7337 | |||
| a3082d0475 | |||
| 3868e0be35 | |||
| 40c98f4f04 | |||
| 032b6f5d0c | |||
| b4c02a96d5 | |||
| 381395acaf | |||
| cf39b64bfc | |||
| c74b8372c0 | |||
| 41bb3f871e | |||
| ff090d63f6 | |||
| c5c6b3da06 | |||
| 6cee953edd | |||
| afe2230ed9 | |||
| 5c5d7c7848 | |||
| 416e41cb00 | |||
| 7d4b6acacd | |||
| dde913b922 |
@@ -17,16 +17,16 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。
|
|||||||
1. cordova create 文件夹名字 包名 应用名字
|
1. cordova create 文件夹名字 包名 应用名字
|
||||||
|
|
||||||
cordova create Myproj com.myproj.jpush MyTestProj
|
cordova create Myproj com.myproj.jpush MyTestProj
|
||||||
|
|
||||||
2. 添加平台
|
2. 添加平台
|
||||||
|
|
||||||
cd Myproj
|
cd Myproj
|
||||||
cordova platform add android
|
cordova platform add android
|
||||||
cordova platform add ios
|
cordova platform add ios
|
||||||
|
|
||||||
ps:这里请注意iOS平台,必须先执行 `cordova platform add ios`,
|
ps:这里请注意iOS平台,必须先执行 `cordova platform add ios`,
|
||||||
然后再执行`cordova plugin add xxxxx`命令,不然有一些必须要的链接库需要手动添加
|
然后再执行`cordova plugin add xxxxx`命令,不然有一些必须要的链接库需要手动添加
|
||||||
|
|
||||||
|
|
||||||
###Cordova CLI/Phonegap 安装 Android & iOS
|
###Cordova CLI/Phonegap 安装 Android & iOS
|
||||||
|
|
||||||
@@ -53,14 +53,14 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。
|
|||||||
|
|
||||||
3). 在js中调用函数,初始化jpush sdk
|
3). 在js中调用函数,初始化jpush sdk
|
||||||
|
|
||||||
window.plugins.jPushPlugin.init();
|
window.plugins.jPushPlugin.init();
|
||||||
//由于phonegap插件采用了Lazy load的特性, 所以这里建议在js文件能执行的最开始就加
|
//由于phonegap插件采用了Lazy load的特性, 所以这里建议在js文件能执行的最开始就加
|
||||||
|
|
||||||
|
|
||||||
### Android 手工安装
|
### Android 手工安装
|
||||||
|
|
||||||
[Android 手工安装文档地址](document/Android_handle_install.md)
|
[Android 手工安装文档地址](document/Android_handle_install.md)
|
||||||
|
|
||||||
|
|
||||||
### IOS手工安装
|
### IOS手工安装
|
||||||
|
|
||||||
@@ -88,10 +88,10 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。
|
|||||||
|
|
||||||
具体的API请参考这里
|
具体的API请参考这里
|
||||||
|
|
||||||
#### iOS和adnroid通用API简介
|
#### iOS和android通用API简介
|
||||||
|
|
||||||
+ 停止与恢复推送服务 API
|
+ 停止与恢复推送服务 API
|
||||||
|
|
||||||
window.plugins.jPushPlugin.init()
|
window.plugins.jPushPlugin.init()
|
||||||
window.plugins.jPushPlugin.stopPush()
|
window.plugins.jPushPlugin.stopPush()
|
||||||
window.plugins.jPushPlugin.resumePush()
|
window.plugins.jPushPlugin.resumePush()
|
||||||
@@ -101,17 +101,17 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。
|
|||||||
+ 获取 RegistrationID API
|
+ 获取 RegistrationID API
|
||||||
|
|
||||||
window.plugins.jPushPlugin.getRegistrationID(callback)
|
window.plugins.jPushPlugin.getRegistrationID(callback)
|
||||||
|
|
||||||
+ 别名与标签 API
|
+ 别名与标签 API
|
||||||
|
|
||||||
window.plugins.jPushPlugin.setTagsWithAlias(tags,alias)
|
window.plugins.jPushPlugin.setTagsWithAlias(tags,alias)
|
||||||
window.plugins.jPushPlugin.setTags(tags)
|
window.plugins.jPushPlugin.setTags(tags)
|
||||||
window.plugins.jPushPlugin.setAlias(alias)
|
window.plugins.jPushPlugin.setAlias(alias)
|
||||||
+ 获取点击通知内容
|
+ 获取点击通知内容
|
||||||
|
|
||||||
event - jpush.openNotification
|
event - jpush.openNotification
|
||||||
+ 获取通知内容
|
+ 获取通知内容
|
||||||
|
|
||||||
event - jpush.receiveNotification
|
event - jpush.receiveNotification
|
||||||
|
|
||||||
+ 获取自定义消息推送内容
|
+ 获取自定义消息推送内容
|
||||||
@@ -128,9 +128,9 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。
|
|||||||
event - jpush.receiveMessage
|
event - jpush.receiveMessage
|
||||||
//推荐使用事件的方式传递,但同时保留了receiveMessageIniOSCallback的回调函数,兼容以前的代码
|
//推荐使用事件的方式传递,但同时保留了receiveMessageIniOSCallback的回调函数,兼容以前的代码
|
||||||
window.plugins.jPushPlugin.receiveMessageIniOSCallback(data)
|
window.plugins.jPushPlugin.receiveMessageIniOSCallback(data)
|
||||||
|
|
||||||
+ 页面的统计
|
+ 页面的统计
|
||||||
|
|
||||||
window.plugins.jPushPlugin.startLogPageView (pageName)
|
window.plugins.jPushPlugin.startLogPageView (pageName)
|
||||||
window.plugins.jPushPlugin.stopLogPageView (pageName)
|
window.plugins.jPushPlugin.stopLogPageView (pageName)
|
||||||
window.plugins.jPushPlugin.beginLogPageView (pageName,duration)
|
window.plugins.jPushPlugin.beginLogPageView (pageName,duration)
|
||||||
@@ -142,31 +142,36 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。
|
|||||||
+ 本地通知
|
+ 本地通知
|
||||||
|
|
||||||
+ 后续版本加入
|
+ 后续版本加入
|
||||||
|
|
||||||
+ 日志等级设置
|
+ 日志等级设置
|
||||||
|
|
||||||
window.plugins.jPushPlugin.setDebugModeFromIos ()
|
window.plugins.jPushPlugin.setDebugModeFromIos ()
|
||||||
window.plugins.jPushPlugin.setLogOFF()
|
window.plugins.jPushPlugin.setLogOFF()
|
||||||
|
|
||||||
|
|
||||||
[iOS API详细说明](document/iOS_detail_api.md)
|
[iOS API详细说明](document/iOS_detail_api.md)
|
||||||
|
|
||||||
|
|
||||||
#### adnroid API简介
|
#### android API简介
|
||||||
|
|
||||||
+ 获取集成日志
|
+ 获取集成日志
|
||||||
window.plugins.jPushPlugin.setDebugMode(mode)
|
window.plugins.jPushPlugin.setDebugMode(mode)
|
||||||
|
|
||||||
+ 接收推送消息和点击通知
|
+ 接收推送消息和点击通知
|
||||||
|
|
||||||
//下面这两个api 是兼容旧有的代码
|
//下面这两个api 是兼容旧有的代码
|
||||||
window.plugins.jPushPlugin.receiveMessageInAndroidCallback(data)
|
window.plugins.jPushPlugin.receiveMessageInAndroidCallback(data)
|
||||||
window.plugins.jPushPlugin.openNotificationInAndroidCallback(data)
|
window.plugins.jPushPlugin.openNotificationInAndroidCallback(data)
|
||||||
|
|
||||||
+ 统计分析 API
|
+ 统计分析 API
|
||||||
|
|
||||||
onResume / onPause(java api)
|
window.plugins.jPushPlugin.setStatisticsOpen(boolean)
|
||||||
|
|
||||||
|
或在 MainActivity 中的 onPause() 和 onResume() 方法中分别调用
|
||||||
|
JPushInterface.onResume(this) 和 JPushInterface.onPause(this) 来启用统计分析功能,
|
||||||
|
如果使用这种方式启用统计分析功能,则window.plugins.jPushPlugin.setStatisticsOpen(boolean)
|
||||||
|
方法不再有效,建议不要同时使用。
|
||||||
|
|
||||||
+ 清除通知 API
|
+ 清除通知 API
|
||||||
|
|
||||||
window.plugins.jPushPlugin.clearAllNotification()
|
window.plugins.jPushPlugin.clearAllNotification()
|
||||||
@@ -177,11 +182,11 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。
|
|||||||
window.plugins.jPushPlugin.setCustomPushNotificationBuilder = function()
|
window.plugins.jPushPlugin.setCustomPushNotificationBuilder = function()
|
||||||
|
|
||||||
+ 设置保留最近通知条数 API
|
+ 设置保留最近通知条数 API
|
||||||
|
|
||||||
window.plugins.jPushPlugin.setLatestNotificationNum(num)
|
window.plugins.jPushPlugin.setLatestNotificationNum(num)
|
||||||
|
|
||||||
+ 本地通知API
|
+ 本地通知API
|
||||||
|
|
||||||
window.plugins.jPushPlugin.addLocalNotification(builderId,
|
window.plugins.jPushPlugin.addLocalNotification(builderId,
|
||||||
content,
|
content,
|
||||||
title,
|
title,
|
||||||
@@ -195,18 +200,18 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。
|
|||||||
|
|
||||||
###常见问题
|
###常见问题
|
||||||
|
|
||||||
####1. androd
|
####1. android
|
||||||
|
|
||||||
eclipse中phonegap工程import之后出现:`Type CallbackContext cannot be resolved to a type`
|
eclipse中phonegap工程import之后出现:`Type CallbackContext cannot be resolved to a type`
|
||||||
解决方案:eclipse中右键单击工程名,Build Path->Config Build Path->Projects->选中 工程名称-CordovaLib->点击 add
|
解决方案:eclipse中右键单击工程名,Build Path->Config Build Path->Projects->选中 工程名称-CordovaLib->点击 add
|
||||||
|
|
||||||
####2. iOS 设置/修改 APP_KEY
|
####2. iOS 设置/修改 APP_KEY
|
||||||
|
|
||||||
在PushConfig.plist 中修改。PushConfig.plist 其他值说明:
|
在PushConfig.plist 中修改。PushConfig.plist 其他值说明:
|
||||||
CHANNEL 渠道标识
|
CHANNEL 渠道标识
|
||||||
IsProduction 是否生产环境(暂未启用)
|
IsProduction 是否生产环境(暂未启用)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###更多
|
###更多
|
||||||
[JPush官网文档](http://docs.jpush.io/)
|
[JPush官网文档](http://docs.jpush.io/)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.receiveMessageInAndroidCallback = function(data)
|
window.plugins.jPushPlugin.receiveMessageInAndroidCallback = function(data)
|
||||||
|
|
||||||
##### 参数说明
|
##### 参数说明
|
||||||
- data 接收到的js字符串,包含的key:value请进入该函数体查看
|
- data 接收到的js字符串,包含的key:value请进入该函数体查看
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.openNotificationInAndroidCallback = function(data)
|
window.plugins.jPushPlugin.openNotificationInAndroidCallback = function(data)
|
||||||
|
|
||||||
##### 参数说明
|
##### 参数说明
|
||||||
- data js字符串
|
- data js字符串
|
||||||
|
|
||||||
@@ -80,6 +80,19 @@
|
|||||||
JPushInterface.onPause(this);
|
JPushInterface.onPause(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#### API - setStatisticsOpen(boolean)
|
||||||
|
|
||||||
|
用于在 js 中控制是否打开应用的统计分析功能,但如果已经添加了上面的 onResume/onPause 方法,
|
||||||
|
就不能再通过这个方法来控制统计分析功能了。
|
||||||
|
|
||||||
|
#### 接口定义
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.setStatisticsOpen(boolean)
|
||||||
|
|
||||||
|
#### 参数说明
|
||||||
|
- boolean
|
||||||
|
-true : 打开统计分析功能
|
||||||
|
-false: 关闭统计分析功能
|
||||||
|
|
||||||
#### API - reportNotificationOpened
|
#### API - reportNotificationOpened
|
||||||
|
|
||||||
@@ -89,7 +102,7 @@
|
|||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.reportNotificationOpened(msgID)
|
window.plugins.jPushPlugin.reportNotificationOpened(msgID)
|
||||||
|
|
||||||
##### 参数说明
|
##### 参数说明
|
||||||
- msgID
|
- msgID
|
||||||
-收到的通知或者自定义消息的id
|
-收到的通知或者自定义消息的id
|
||||||
@@ -117,14 +130,14 @@
|
|||||||
当用户需要定制默认的通知栏样式时,则可调用此方法。
|
当用户需要定制默认的通知栏样式时,则可调用此方法。
|
||||||
极光 Push SDK 提供了 2 个用于定制通知栏样式的构建类:
|
极光 Push SDK 提供了 2 个用于定制通知栏样式的构建类:
|
||||||
|
|
||||||
- setBasicPushNotificationBuilder
|
- setBasicPushNotificationBuilder
|
||||||
- Basic 用于定制 Android Notification 里的 defaults / flags / icon 等基础样式(行为)
|
- Basic 用于定制 Android Notification 里的 defaults / flags / icon 等基础样式(行为)
|
||||||
- setCustomPushNotificationBuilder
|
- setCustomPushNotificationBuilder
|
||||||
- 继承 Basic 进一步让开发者定制 Notification Layout
|
- 继承 Basic 进一步让开发者定制 Notification Layout
|
||||||
|
|
||||||
如果不调用此方法定制,则极光Push SDK 默认的通知栏样式是:Android标准的通知栏提示。
|
如果不调用此方法定制,则极光Push SDK 默认的通知栏样式是:Android标准的通知栏提示。
|
||||||
|
|
||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.setBasicPushNotificationBuilder = function()
|
window.plugins.jPushPlugin.setBasicPushNotificationBuilder = function()
|
||||||
window.plugins.jPushPlugin.setCustomPushNotificationBuilder = function()
|
window.plugins.jPushPlugin.setCustomPushNotificationBuilder = function()
|
||||||
@@ -143,7 +156,7 @@
|
|||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.setLatestNotificationNum(num)
|
window.plugins.jPushPlugin.setLatestNotificationNum(num)
|
||||||
|
|
||||||
##### 参数说明
|
##### 参数说明
|
||||||
|
|
||||||
- num 保存的条数
|
- num 保存的条数
|
||||||
@@ -181,5 +194,3 @@
|
|||||||
- notificaitonID 设置本地通知的ID
|
- notificaitonID 设置本地通知的ID
|
||||||
- broadcastTime 设置本地通知触发时间,为距离当前时间的数值,单位是毫秒
|
- broadcastTime 设置本地通知触发时间,为距离当前时间的数值,单位是毫秒
|
||||||
- extras 设置额外的数据信息extras为json字符串
|
- extras 设置额外的数据信息extras为json字符串
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
1. 复制:`$JPUSH_PLUGIN_DIR`/src/android/*.java 到cn/jpush/phonega/目录下(即:cn.jpush.phonegap的包下)
|
1. 复制:`$JPUSH_PLUGIN_DIR`/src/android/*.java 到cn/jpush/phonega/目录下(即:cn.jpush.phonegap的包下)
|
||||||
2. 复制:`$JPUSH_PLUGIN_DIR`/src/android/armeabi/libjpush.so 到lib/armeabi/
|
2. 复制:`$JPUSH_PLUGIN_DIR`/src/android/armeabi/libjpush.so 到lib/armeabi/
|
||||||
3. 复制:`$JPUSH_PLUGIN_DIR`/src/android/jpush-sdk-release1.5.0.jar 到lib/
|
3. 复制:`$JPUSH_PLUGIN_DIR`/src/android/jpush-sdk-release2.0.6.jar 到lib/
|
||||||
4. 复制:`$JPUSH_PLUGIN_DIR`/src/android/test_notification_layout.xml到res/layout/
|
4. 复制:`$JPUSH_PLUGIN_DIR`/src/android/test_notification_layout.xml到res/layout/
|
||||||
5. 复制:`$JPUSH_PLUGIN_DIR`/src/android/jpush_notification_icon.png 到res/drawable/
|
5. 复制:`$JPUSH_PLUGIN_DIR`/src/android/jpush_notification_icon.png到res/drawable/
|
||||||
6. 修改 AndroidManifest.xml 在 manifest 节点下添加以下权限
|
6. 修改 AndroidManifest.xml 在 manifest 节点下添加以下权限
|
||||||
|
|
||||||
<!-- Required 一些系统要求的权限,如访问网络等-->
|
<!-- Required 一些系统要求的权限,如访问网络等-->
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<action android:name="cn.jpush.android.intent.REPORT"/>
|
<action android:name="cn.jpush.android.intent.REPORT"/>
|
||||||
<action android:name="cn.jpush.android.intent.PushService"/>
|
<action android:name="cn.jpush.android.intent.PushService"/>
|
||||||
<action android:name="cn.jpush.android.intent.PUSH_TIME"/>
|
<action android:name="cn.jpush.android.intent.PUSH_TIME"/>
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<!-- Required SDK核心功能-->
|
<!-- Required SDK核心功能-->
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
<data android:scheme="package"/>
|
<data android:scheme="package"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="cn.jpush.phonegap.MyReceiver"
|
android:name="cn.jpush.phonegap.MyReceiver"
|
||||||
|
|||||||
+115
-28
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
- data 是一个js字符串使用如下代码解析,js具体key根据应用内消息来确定
|
- data 是一个js字符串使用如下代码解析,js具体key根据应用内消息来确定
|
||||||
|
|
||||||
var bToObj = JSON.parse(data);
|
var bToObj = JSON.parse(data)
|
||||||
|
|
||||||
#####返回值
|
#####返回值
|
||||||
无
|
无
|
||||||
@@ -30,9 +30,9 @@
|
|||||||
本 API 用于“用户指定页面使用时长”的统计,并上报到服务器,在 Portal 上展示给开发者。页面统计集成正确,才能够获取正确的页面访问路径、访问深度(PV)的数据。
|
本 API 用于“用户指定页面使用时长”的统计,并上报到服务器,在 Portal 上展示给开发者。页面统计集成正确,才能够获取正确的页面访问路径、访问深度(PV)的数据。
|
||||||
|
|
||||||
##### 接口定义
|
##### 接口定义
|
||||||
window.plugins.jPushPlugin.startLogPageView = function(pageName)
|
window.plugins.jPushPlugin.prototype.startLogPageView = function(pageName)
|
||||||
window.plugins.jPushPlugin.stopLogPageView = function(pageName)
|
window.plugins.jPushPlugin.prototype.stopLogPageView = function(pageName)
|
||||||
window.plugins.jPushPlugin.beginLogPageView = function(pageName,duration)
|
window.plugins.jPushPlugin.prototype.beginLogPageView = function(pageName,duration)
|
||||||
#####参数说明
|
#####参数说明
|
||||||
pageName 需要统计页面自定义名称
|
pageName 需要统计页面自定义名称
|
||||||
duration 自定义的页面时间
|
duration 自定义的页面时间
|
||||||
@@ -44,11 +44,10 @@ duration 自定义的页面时间
|
|||||||
无
|
无
|
||||||
#####代码示例
|
#####代码示例
|
||||||
|
|
||||||
if(window.plugins.jPushPlugin.isPlatformIOS()){
|
window.plugins.jPushPlugin.beginLogPageView("newPage",5);
|
||||||
window.plugins.jPushPlugin.beginLogPageView("newPage",5);
|
window.plugins.jPushPlugin.startLogPageView("onePage");
|
||||||
window.plugins.jPushPlugin.startLogPageView("onePage");
|
window.plugins.jPushPlugin.stopLogPageView("onePage");
|
||||||
window.plugins.jPushPlugin.stopLogPageView("onePage");
|
|
||||||
}
|
|
||||||
### 设置Badge
|
### 设置Badge
|
||||||
#### API - setBadge,resetBadge
|
#### API - setBadge,resetBadge
|
||||||
|
|
||||||
@@ -58,8 +57,8 @@ duration 自定义的页面时间
|
|||||||
实际应用中,开发者可以直接对badge值做增减操作,无需自己维护用户与badge值之间的对应关系。
|
实际应用中,开发者可以直接对badge值做增减操作,无需自己维护用户与badge值之间的对应关系。
|
||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.setBadge(value)
|
window.plugins.jPushPlugin.prototype.setBadge(value)
|
||||||
window.plugins.jPushPlugin.reSetBadge()
|
window.plugins.jPushPlugin.prototype.reSetBadge()
|
||||||
|
|
||||||
`resetBadge相当于setBadge(0)`
|
`resetBadge相当于setBadge(0)`
|
||||||
##### 参数说明
|
##### 参数说明
|
||||||
@@ -68,10 +67,8 @@ value 取值范围:[0,99999]
|
|||||||
无,控制台会有log打印设置结果
|
无,控制台会有log打印设置结果
|
||||||
#####代码示例
|
#####代码示例
|
||||||
|
|
||||||
if(window.plugins.jPushPlugin.isPlatformIOS()){
|
window.plugins.jPushPlugin.setBadge(5);
|
||||||
window.plugins.jPushPlugin.setBadge(5);
|
window.plugins.jPushPlugin.reSetBadge();
|
||||||
window.plugins.jPushPlugin.reSetBadge();
|
|
||||||
}
|
|
||||||
|
|
||||||
#### API - setApplicationIconBadgeNumber
|
#### API - setApplicationIconBadgeNumber
|
||||||
|
|
||||||
@@ -80,7 +77,7 @@ value 取值范围:[0,99999]
|
|||||||
|
|
||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.setApplicationIconBadgeNumber(badge)
|
window.plugins.jPushPlugin.prototype.setApplicationIconBadgeNumber(badge)
|
||||||
|
|
||||||
##### 参数说明
|
##### 参数说明
|
||||||
|
|
||||||
@@ -89,9 +86,7 @@ value 取值范围:[0,99999]
|
|||||||
|
|
||||||
#####代码示例
|
#####代码示例
|
||||||
|
|
||||||
if(window.plugins.jPushPlugin.isPlatformIOS()){
|
window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0);
|
||||||
window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#### API - getApplicationIconBadgeNumber
|
#### API - getApplicationIconBadgeNumber
|
||||||
@@ -100,7 +95,7 @@ value 取值范围:[0,99999]
|
|||||||
|
|
||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.getApplicationIconBadgeNumber(callback)
|
window.plugins.jPushPlugin.prototype.getApplicationIconBadgeNumber(callback)
|
||||||
|
|
||||||
##### 参数说明
|
##### 参数说明
|
||||||
|
|
||||||
@@ -116,7 +111,56 @@ window.plugins.jPushPlugin.getApplicationIconBadgeNumber(function(data){
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 本地通知
|
### 本地通知
|
||||||
|
#### API - addLocalNotificationForIOS
|
||||||
|
|
||||||
|
API用于注册本地通知
|
||||||
|
|
||||||
|
最多支持64个
|
||||||
|
|
||||||
|
##### 接口定义
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.prototype.addLocalNotificationForIOS(delayTime,content,badge,notificationID,extras)
|
||||||
|
|
||||||
|
##### 参数说明
|
||||||
|
|
||||||
|
- delayTime 本地推送延迟多长时间后显示,数值类型或纯数字的字符型均可
|
||||||
|
- content 本地推送需要显示的内容
|
||||||
|
- badge 角标的数字。如果不需要改变角标传-1。数值类型或纯数字的字符型均可
|
||||||
|
- notificationID 本地推送标识符,字符串。
|
||||||
|
- extras 自定义参数,可以用来标识推送和增加附加信息。字典类型。
|
||||||
|
|
||||||
|
#####代码示例
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.addLocalNotificationForIOS(6*60*60,"本地推送内容",1,"notiId",{"key":"value"});
|
||||||
|
|
||||||
|
#### API - deleteLocalNotificationWithIdentifierKeyInIOS
|
||||||
|
|
||||||
|
API删除本地推送定义
|
||||||
|
|
||||||
|
##### 接口定义
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.prototype.deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey)
|
||||||
|
|
||||||
|
##### 参数说明
|
||||||
|
|
||||||
|
- identifierKey 本地推送标识符
|
||||||
|
|
||||||
|
#####代码示例
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS("identifier");
|
||||||
|
|
||||||
|
#### API - clearAllLocalNotifications
|
||||||
|
|
||||||
|
API清除所有本地推送对象
|
||||||
|
|
||||||
|
##### 接口定义
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.prototype.clearAllLocalNotifications()
|
||||||
|
|
||||||
|
#####代码示例
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.clearAllLocalNotifications();
|
||||||
|
|
||||||
### 日志等级设置
|
### 日志等级设置
|
||||||
#### API - setDebugModeFromIos
|
#### API - setDebugModeFromIos
|
||||||
API 用于开启Debug模式,显示更多的日志信息
|
API 用于开启Debug模式,显示更多的日志信息
|
||||||
@@ -124,13 +168,11 @@ API 用于开启Debug模式,显示更多的日志信息
|
|||||||
建议调试时开启这个选项,不调试的时候注释这句代码,这个函数setLogOFF是相反的一对
|
建议调试时开启这个选项,不调试的时候注释这句代码,这个函数setLogOFF是相反的一对
|
||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.reSetBadge.setDebugModeFromIos()
|
window.plugins.jPushPlugin.prototype.setDebugModeFromIos()
|
||||||
|
|
||||||
#####代码示例
|
#####代码示例
|
||||||
|
|
||||||
if(window.plugins.jPushPlugin.isPlatformIOS()){
|
window.plugins.jPushPlugin.setDebugModeFromIos();
|
||||||
window.plugins.jPushPlugin.setDebugModeFromIos();
|
|
||||||
}
|
|
||||||
|
|
||||||
#### API - setLogOFF
|
#### API - setLogOFF
|
||||||
|
|
||||||
@@ -140,11 +182,56 @@ API用来关闭日志信息(除了必要的错误信息)
|
|||||||
|
|
||||||
##### 接口定义
|
##### 接口定义
|
||||||
|
|
||||||
window.plugins.jPushPlugin.reSetBadge.setLogOFF ()
|
window.plugins.jPushPlugin.prototype.setLogOFF()
|
||||||
|
|
||||||
#####代码示例
|
#####代码示例
|
||||||
|
|
||||||
if(window.plugins.jPushPlugin.isPlatformIOS()){
|
window.plugins.jPushPlugin.setLogOFF();
|
||||||
window.plugins.jPushPlugin.setLogOFF();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#### API - setCrashLogON
|
||||||
|
|
||||||
|
API用于统计用户应用崩溃日志
|
||||||
|
|
||||||
|
如果需要统计Log信息,调用该接口。当你需要自己收集错误信息时,切记不要调用该接口。
|
||||||
|
|
||||||
|
|
||||||
|
##### 接口定义
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.prototype.setCrashLogON()
|
||||||
|
|
||||||
|
#####代码示例
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.setCrashLogON();
|
||||||
|
|
||||||
|
### 地理位置上报
|
||||||
|
#### API - setLocation
|
||||||
|
API 用于统计用户地理信息
|
||||||
|
|
||||||
|
##### 接口定义
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.prototype.setLocation(latitude,longitude)
|
||||||
|
|
||||||
|
##### 参数说明
|
||||||
|
|
||||||
|
- latitude 地理位置纬度,数值类型或纯数字的字符型均可
|
||||||
|
- longitude 地理位置精度,数值类型或纯数字的字符型均可
|
||||||
|
|
||||||
|
#####代码示例
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.setLocation(39.26,115.25);
|
||||||
|
|
||||||
|
### 设备平台判断
|
||||||
|
#### API - isPlatformIOS
|
||||||
|
API 用于区分iOS、Android平台,以便不同设置
|
||||||
|
|
||||||
|
##### 接口定义
|
||||||
|
|
||||||
|
window.plugins.jPushPlugin.prototype.isPlatformIOS()
|
||||||
|
|
||||||
|
#####代码示例
|
||||||
|
|
||||||
|
if(window.plugins.jPushPlugin.isPlatformIOS()){
|
||||||
|
//iOS
|
||||||
|
}else{
|
||||||
|
//Android
|
||||||
|
}
|
||||||
|
|||||||
+1
-2
@@ -105,6 +105,7 @@
|
|||||||
window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0);
|
window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0);
|
||||||
} else {
|
} else {
|
||||||
window.plugins.jPushPlugin.setDebugMode(true);
|
window.plugins.jPushPlugin.setDebugMode(true);
|
||||||
|
window.plugins.jPushPlugin.setStatisticsOpen(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (exception) {
|
catch (exception) {
|
||||||
@@ -220,5 +221,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+10
-8
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<header-file src="src/ios/Plugins/JPushPlugin.h"/>
|
<header-file src="src/ios/Plugins/JPushPlugin.h"/>
|
||||||
<source-file src="src/ios/Plugins/JPushPlugin.m"/>
|
<source-file src="src/ios/Plugins/JPushPlugin.m"/>
|
||||||
|
|
||||||
<header-file src="src/ios/lib/JPUSHService.h" />
|
<header-file src="src/ios/lib/JPUSHService.h" />
|
||||||
<source-file src="src/ios/lib/jpush-ios-2.1.0.a" framework="true" />
|
<source-file src="src/ios/lib/jpush-ios-2.1.0.a" framework="true" />
|
||||||
<header-file src="src/ios/Plugins/AppDelegate+JPush.h"/>
|
<header-file src="src/ios/Plugins/AppDelegate+JPush.h"/>
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<string>$API_KEY</string>
|
<string>$API_KEY</string>
|
||||||
</config-file>
|
</config-file>
|
||||||
</platform>
|
</platform>
|
||||||
|
|
||||||
<!-- android -->
|
<!-- android -->
|
||||||
<platform name="android">
|
<platform name="android">
|
||||||
<hook type="after_plugin_add" src="scripts/android-install.js" />
|
<hook type="after_plugin_add" src="scripts/android-install.js" />
|
||||||
<hook type="after_plugin_install" src="scripts/android-install.js" />
|
<hook type="after_plugin_install" src="scripts/android-install.js" />
|
||||||
<hook type="before_plugin_rm" src="scripts/android-install.js" />
|
<hook type="before_plugin_rm" src="scripts/android-install.js" />
|
||||||
<hook type="before_plugin_uninstall" src="scripts/android-install.js" />
|
<hook type="before_plugin_uninstall" src="scripts/android-install.js" />
|
||||||
|
|
||||||
<config-file target="res/xml/config.xml" parent="/*">
|
<config-file target="res/xml/config.xml" parent="/*">
|
||||||
<feature name="JPushPlugin">
|
<feature name="JPushPlugin">
|
||||||
<param name="android-package" value="cn.jpush.phonegap.JPushPlugin"/>
|
<param name="android-package" value="cn.jpush.phonegap.JPushPlugin"/>
|
||||||
@@ -163,11 +163,13 @@
|
|||||||
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
|
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
|
||||||
<meta-data android:name="JPUSH_APPKEY" android:value="$API_KEY"/>
|
<meta-data android:name="JPUSH_APPKEY" android:value="$API_KEY"/>
|
||||||
</config-file>
|
</config-file>
|
||||||
<source-file src="src/android/jpush-android-2.0.6.jar" target-dir="libs"/>
|
<source-file src="src/android/jpush-android-2.1.0.jar" target-dir="libs"/>
|
||||||
<source-file src="src/android/armeabi/libjpush206.so" target-dir="libs/armeabi"/>
|
<source-file src="src/android/armeabi/libjpush210.so" target-dir="libs/armeabi"/>
|
||||||
<source-file src="src/android/armeabi-v7a/libjpush206.so" target-dir="libs/armeabi-v7a"/>
|
<source-file src="src/android/armeabi-v7a/libjpush210.so" target-dir="libs/armeabi-v7a"/>
|
||||||
<source-file src="src/android/arm64-v8a/libjpush206.so" target-dir="libs/arm64-v8a"/>
|
<source-file src="src/android/arm64-v8a/libjpush210.so" target-dir="libs/arm64-v8a"/>
|
||||||
|
<source-file src="src/android/x86/libjpush210.so" target-dir="libs/x86"/>
|
||||||
|
<source-file src="src/android/x86_64/libjpush210.so" target-dir="libs/x86_64"/>
|
||||||
|
|
||||||
<!--<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jpush/phonegap"/>-->
|
<!--<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jpush/phonegap"/>-->
|
||||||
<source-file src="src/android/MyReceiver.java" target-dir="src/cn/jpush/phonegap"/>
|
<source-file src="src/android/MyReceiver.java" target-dir="src/cn/jpush/phonegap"/>
|
||||||
<source-file src="src/android/test_notification_layout.xml" target-dir="res/layout"/>
|
<source-file src="src/android/test_notification_layout.xml" target-dir="res/layout"/>
|
||||||
|
|||||||
+457
-479
File diff suppressed because it is too large
Load Diff
+71
-71
@@ -12,82 +12,82 @@ import android.content.Intent;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class MyReceiver extends BroadcastReceiver {
|
public class MyReceiver extends BroadcastReceiver {
|
||||||
private static String TAG = "JPushPlugin";
|
private static String TAG = "JPushPlugin";
|
||||||
@Override
|
private static final List<String> IGNORED_EXTRAS_KEYS =
|
||||||
public void onReceive(Context context, Intent intent) {
|
Arrays.asList(
|
||||||
|
"cn.jpush.android.TITLE",
|
||||||
|
"cn.jpush.android.MESSAGE",
|
||||||
|
"cn.jpush.android.APPKEY",
|
||||||
|
"cn.jpush.android.NOTIFICATION_CONTENT_TITLE"
|
||||||
|
);
|
||||||
|
|
||||||
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
// }else if (JPushInterface.ACTION_UNREGISTER.equals(intent.getAction())){
|
String action = intent.getAction();
|
||||||
|
if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(action)) {
|
||||||
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
|
handlingReceivedMessage(intent);
|
||||||
handlingReceivedMessage(intent);
|
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(action)) {
|
||||||
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
|
handlingNotificationReceive(context, intent);
|
||||||
handlingNotificationReceive(context,intent);
|
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(action)) {
|
||||||
|
handlingNotificationOpen(context, intent);
|
||||||
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
|
|
||||||
handlingNotificationOpen(context,intent);
|
|
||||||
} else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Unhandled intent - " + intent.getAction());
|
Log.d(TAG, "Unhandled intent - " + action);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
private void handlingReceivedMessage(Intent intent) {
|
|
||||||
String msg = intent.getStringExtra(JPushInterface.EXTRA_MESSAGE);
|
|
||||||
Map<String,Object> extras = getNotificationExtras(intent);
|
|
||||||
|
|
||||||
|
|
||||||
JPushPlugin.transmitPush(msg, extras);
|
|
||||||
}
|
|
||||||
private void handlingNotificationOpen(Context context,Intent intent){
|
|
||||||
Log.i(TAG, "---------------- handlingNotificationOpen");
|
|
||||||
|
|
||||||
String alert = intent.getStringExtra(JPushInterface.EXTRA_ALERT);
|
private void handlingReceivedMessage(Intent intent) {
|
||||||
Map<String,Object> extras = getNotificationExtras(intent);
|
String msg = intent.getStringExtra(JPushInterface.EXTRA_MESSAGE);
|
||||||
|
Map<String, Object> extras = getNotificationExtras(intent);
|
||||||
Intent launch = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
|
JPushPlugin.transmitPush(msg, extras);
|
||||||
launch.addCategory(Intent.CATEGORY_LAUNCHER);
|
}
|
||||||
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
||||||
JPushPlugin.openNotificationAlert = alert;
|
|
||||||
JPushPlugin.openNotificationExtras = extras;
|
|
||||||
|
|
||||||
JPushPlugin.transmitOpen(alert, extras);
|
|
||||||
|
|
||||||
context.startActivity(launch);
|
private void handlingNotificationOpen(Context context, Intent intent) {
|
||||||
}
|
Log.i(TAG, "---------------- handlingNotificationOpen");
|
||||||
private void handlingNotificationReceive(Context context,Intent intent){
|
|
||||||
|
|
||||||
Log.i(TAG, "---------------- handlingNotificationReceive");
|
String alert = intent.getStringExtra(JPushInterface.EXTRA_ALERT);
|
||||||
|
JPushPlugin.openNotificationAlert = alert;
|
||||||
|
|
||||||
|
Map<String, Object> extras = getNotificationExtras(intent);
|
||||||
|
JPushPlugin.openNotificationExtras = extras;
|
||||||
|
|
||||||
|
JPushPlugin.transmitOpen(alert, extras);
|
||||||
|
|
||||||
|
Intent launch = context.getPackageManager().getLaunchIntentForPackage(
|
||||||
|
context.getPackageName());
|
||||||
|
launch.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
|
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
context.startActivity(launch);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handlingNotificationReceive(Context context, Intent intent) {
|
||||||
|
Log.i(TAG, "---------------- handlingNotificationReceive");
|
||||||
|
|
||||||
|
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 alert = intent.getStringExtra(JPushInterface.EXTRA_ALERT);
|
||||||
|
JPushPlugin.notificationAlert = alert;
|
||||||
|
|
||||||
|
Map<String, Object> extras = getNotificationExtras(intent);
|
||||||
|
JPushPlugin.notificationExtras = extras;
|
||||||
|
|
||||||
|
JPushPlugin.transmitReceive(alert, extras);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> getNotificationExtras(Intent intent) {
|
||||||
|
Map<String, Object> extrasMap = new HashMap<String, Object>();
|
||||||
|
for (String key : intent.getExtras().keySet()) {
|
||||||
|
if (!IGNORED_EXTRAS_KEYS.contains(key)) {
|
||||||
|
Log.e("key", "key:" + key);
|
||||||
|
if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
|
||||||
|
extrasMap.put(key, intent.getIntExtra(key, 0));
|
||||||
|
} else {
|
||||||
|
extrasMap.put(key, intent.getStringExtra(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return extrasMap;
|
||||||
|
}
|
||||||
|
|
||||||
String alert = intent.getStringExtra(JPushInterface.EXTRA_ALERT);
|
|
||||||
Map<String,Object> extras = getNotificationExtras(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);
|
|
||||||
|
|
||||||
JPushPlugin.notificationAlert = alert;
|
|
||||||
JPushPlugin.notificationExtras = extras;
|
|
||||||
|
|
||||||
JPushPlugin.transmitReceive(alert, extras);
|
|
||||||
}
|
|
||||||
private Map<String, Object> getNotificationExtras(Intent intent) {
|
|
||||||
Map<String, Object> extrasMap = new HashMap<String, Object>();
|
|
||||||
|
|
||||||
for (String key : intent.getExtras().keySet()) {
|
|
||||||
if (!IGNORED_EXTRAS_KEYS.contains(key)) {
|
|
||||||
Log.e("key","key:"+key);
|
|
||||||
if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)){
|
|
||||||
extrasMap.put(key, intent.getIntExtra(key,0));
|
|
||||||
}else{
|
|
||||||
extrasMap.put(key, intent.getStringExtra(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return extrasMap;
|
|
||||||
}
|
|
||||||
private static final List<String> IGNORED_EXTRAS_KEYS =
|
|
||||||
Arrays.asList("cn.jpush.android.TITLE","cn.jpush.android.MESSAGE","cn.jpush.android.APPKEY","cn.jpush.android.NOTIFICATION_CONTENT_TITLE");
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,6 +10,4 @@
|
|||||||
|
|
||||||
@interface AppDelegate (JPush)
|
@interface AppDelegate (JPush)
|
||||||
|
|
||||||
//@property(nonatomic,strong)NSDictionary *luanchOption;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -7,26 +7,21 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "AppDelegate+JPush.h"
|
#import "AppDelegate+JPush.h"
|
||||||
#import <objc/runtime.h>
|
|
||||||
#import "JPushPlugin.h"
|
#import "JPushPlugin.h"
|
||||||
#import "JPUSHService.h"
|
#import "JPUSHService.h"
|
||||||
|
#import <objc/runtime.h>
|
||||||
//static char launchNotificationKey;
|
|
||||||
|
|
||||||
@implementation AppDelegate (JPush)
|
@implementation AppDelegate (JPush)
|
||||||
|
|
||||||
+(void)load{
|
+(void)load{
|
||||||
|
|
||||||
Method origin;
|
Method origin;
|
||||||
Method swizzle;
|
Method swizzle;
|
||||||
|
|
||||||
origin=class_getInstanceMethod([self class],@selector(init));
|
origin=class_getInstanceMethod([self class],@selector(init));
|
||||||
swizzle=class_getInstanceMethod([self class], @selector(init_plus));
|
swizzle=class_getInstanceMethod([self class], @selector(init_plus));
|
||||||
method_exchangeImplementations(origin, swizzle);
|
method_exchangeImplementations(origin, swizzle);
|
||||||
}
|
}
|
||||||
|
|
||||||
-(instancetype)init_plus{
|
-(instancetype)init_plus{
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(applicationDidLaunch:)
|
selector:@selector(applicationDidLaunch:)
|
||||||
name:@"UIApplicationDidFinishLaunchingNotification"
|
name:@"UIApplicationDidFinishLaunchingNotification"
|
||||||
@@ -34,60 +29,38 @@
|
|||||||
return [self init_plus];
|
return [self init_plus];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)applicationDidLaunch:(NSNotification *)notification{
|
-(void)applicationDidLaunch:(NSNotification*)notification{
|
||||||
|
|
||||||
if (notification) {
|
if (notification) {
|
||||||
[JPushPlugin setLaunchOptions:notification.userInfo];
|
[JPushPlugin setLaunchOptions:notification.userInfo];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
||||||
[JPUSHService registerDeviceToken:deviceToken];
|
[JPUSHService registerDeviceToken:deviceToken];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
|
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
|
||||||
|
|
||||||
[JPUSHService handleRemoteNotification:userInfo];
|
[JPUSHService handleRemoteNotification:userInfo];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:kJPushPluginReceiveNotification
|
[[NSNotificationCenter defaultCenter] postNotificationName:kJPushPluginReceiveNotification object:userInfo];
|
||||||
object:userInfo];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
|
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
|
||||||
|
|
||||||
[JPUSHService handleRemoteNotification:userInfo];
|
[JPUSHService handleRemoteNotification:userInfo];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:kJPushPluginReceiveNotification
|
[[NSNotificationCenter defaultCenter] postNotificationName:kJPushPluginReceiveNotification object:userInfo];
|
||||||
object:userInfo];
|
|
||||||
completionHandler(UIBackgroundFetchResultNewData);
|
completionHandler(UIBackgroundFetchResultNewData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)application:(UIApplication *)application
|
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
|
||||||
didReceiveLocalNotification:(UILocalNotification *)notification {
|
[JPUSHService showLocalNotificationAtFront:notification identifierKey:nil];
|
||||||
[JPUSHService showLocalNotificationAtFront:notification identifierKey:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||||
// [application setApplicationIconBadgeNumber:0];
|
// [application setApplicationIconBadgeNumber:0];
|
||||||
// [application cancelAllLocalNotifications];
|
// [application cancelAllLocalNotifications];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||||
// [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
|
// [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//delegate里不能声明变量,所以采用关联对象这种技术绕过这个限制
|
|
||||||
//-(NSDictionary *)luanchOption{
|
|
||||||
// return objc_getAssociatedObject(self, &launchNotificationKey);
|
|
||||||
//}
|
|
||||||
//-(void)setLuanchOption:(NSDictionary *)luanchOption{
|
|
||||||
// objc_setAssociatedObject(self, &launchNotificationKey, luanchOption, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
||||||
//}
|
|
||||||
//-(void)dealloc{
|
|
||||||
// self.luanchOption=nil;
|
|
||||||
//}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -11,28 +11,59 @@
|
|||||||
#define kJPushPluginReceiveNotification @"JPushPluginReceiveNofication"
|
#define kJPushPluginReceiveNotification @"JPushPluginReceiveNofication"
|
||||||
|
|
||||||
@interface JPushPlugin : CDVPlugin{
|
@interface JPushPlugin : CDVPlugin{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+(void)setLaunchOptions:(NSDictionary *)theLaunchOptions;
|
+(void)setLaunchOptions:(NSDictionary *)theLaunchOptions;
|
||||||
|
|
||||||
|
//以下为js中可调用接口
|
||||||
|
//设置标签、别名
|
||||||
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command;
|
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)setTags:(CDVInvokedUrlCommand*)command;
|
-(void)setTags:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)setAlias:(CDVInvokedUrlCommand*)command;
|
-(void)setAlias:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
//获取 RegistrationID
|
||||||
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command;
|
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
//页面统计
|
||||||
-(void)startLogPageView:(CDVInvokedUrlCommand*)command;
|
-(void)startLogPageView:(CDVInvokedUrlCommand*)command;
|
||||||
-(void)stopLogPageView:(CDVInvokedUrlCommand*)command;
|
-(void)stopLogPageView:(CDVInvokedUrlCommand*)command;
|
||||||
|
-(void)beginLogPageView:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
// 设置角标到服务器, 服务器下一次发消息时,会设置成这个值
|
//设置角标到服务器,服务器下一次发消息时,会设置成这个值
|
||||||
//本接口不会改变应用本地的角标值.
|
//本接口不会改变应用本地的角标值.
|
||||||
-(void)setBadge:(CDVInvokedUrlCommand*)command;
|
-(void)setBadge:(CDVInvokedUrlCommand*)command;
|
||||||
//相当于 [setBadge:0]
|
//相当于 [setBadge:0]
|
||||||
-(void)resetBadge:(CDVInvokedUrlCommand*)command;
|
-(void)resetBadge:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
//应用本地的角标值设置/获取
|
||||||
//改变应用本地的角标值.
|
|
||||||
-(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
|
-(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
|
||||||
//获取应用本地的角标值.
|
|
||||||
-(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
|
-(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
//停止与恢复推送
|
||||||
|
-(void)stopPush:(CDVInvokedUrlCommand*)command;
|
||||||
|
-(void)resumePush:(CDVInvokedUrlCommand*)command;
|
||||||
|
-(void)isPushStopped:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
//开关日志
|
||||||
|
-(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command;
|
||||||
|
-(void)setLogOFF:(CDVInvokedUrlCommand*)command;
|
||||||
|
-(void)crashLogON:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
//本地推送
|
||||||
|
-(void)setLocalNotification:(CDVInvokedUrlCommand*)command;
|
||||||
|
-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command;
|
||||||
|
-(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
//地理位置上报 [latitude,longitude]
|
||||||
|
-(void)setLocation:(CDVInvokedUrlCommand*)command;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 以下为js中可监听到的事件
|
||||||
|
* jpush.openNotification 点击推送消息唤醒或启动app
|
||||||
|
* jpush.setTagsWithAlias 设置标签、别名完成
|
||||||
|
* jpush.receiveMessage 收到自定义消息
|
||||||
|
* jpush.receiveNotification 前台收到推送消息
|
||||||
|
*/
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
+275
-352
@@ -10,452 +10,375 @@
|
|||||||
#import "JPUSHService.h"
|
#import "JPUSHService.h"
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static NSString *const JM_APP_KEY = @"APP_KEY";
|
static NSString *const JM_APP_KEY = @"APP_KEY";
|
||||||
static NSString *const JM_APP_CHANNEL = @"CHANNEL";
|
static NSString *const JM_APP_CHANNEL = @"CHANNEL";
|
||||||
static NSString *const JM_APP_ISPRODUCTION = @"IsProduction";
|
static NSString *const JM_APP_ISPRODUCTION = @"IsProduction";
|
||||||
|
static NSString *const JPushConfigFileName = @"PushConfig";
|
||||||
static NSString *const JMessageConfigFileName = @"PushConfig";
|
static NSDictionary *_luanchOptions = nil;
|
||||||
|
|
||||||
|
|
||||||
static NSDictionary *_luanchOptions=nil;
|
|
||||||
|
|
||||||
@implementation JPushPlugin
|
@implementation JPushPlugin
|
||||||
|
|
||||||
|
#pragma mark- 外部接口
|
||||||
+(void)setLaunchOptions:(NSDictionary *)theLaunchOptions{
|
|
||||||
_luanchOptions=theLaunchOptions;
|
|
||||||
[JPUSHService setDebugMode];
|
|
||||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
|
|
||||||
//可以添加自定义categories
|
|
||||||
[JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
|
|
||||||
UIUserNotificationTypeSound |
|
|
||||||
UIUserNotificationTypeAlert)
|
|
||||||
categories:nil];
|
|
||||||
} else {
|
|
||||||
//categories 必须为nil
|
|
||||||
[JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
|
||||||
UIRemoteNotificationTypeSound |
|
|
||||||
UIRemoteNotificationTypeAlert)
|
|
||||||
categories:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
//read appkey and channel from JMessageConfig.plist
|
|
||||||
NSString *plistPath = [[NSBundle mainBundle] pathForResource:JMessageConfigFileName ofType:@"plist"];
|
|
||||||
if (plistPath == nil) {
|
|
||||||
NSLog(@"error: PushConfig.plist not found");
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
|
|
||||||
NSString * appkey = [plistData valueForKey:JM_APP_KEY];
|
|
||||||
NSString * channel = [plistData valueForKey:JM_APP_CHANNEL];
|
|
||||||
NSNumber * isProduction = [plistData valueForKey:JM_APP_ISPRODUCTION];
|
|
||||||
|
|
||||||
if (!appkey || appkey.length == 0) {
|
|
||||||
NSLog(@"error: app key not found in JMessageConfig.plist ");
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[JPUSHService setupWithOption:_luanchOptions appKey:appkey
|
|
||||||
channel:channel apsForProduction:[isProduction boolValue] ];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-(void)stopPush:(CDVInvokedUrlCommand*)command{
|
-(void)stopPush:(CDVInvokedUrlCommand*)command{
|
||||||
|
[[UIApplication sharedApplication]unregisterForRemoteNotifications];
|
||||||
[[UIApplication sharedApplication]unregisterForRemoteNotifications];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void)resumePush:(CDVInvokedUrlCommand*)command{
|
-(void)resumePush:(CDVInvokedUrlCommand*)command{
|
||||||
|
[JPushPlugin registerForRemoteNotification];
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1
|
|
||||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
|
|
||||||
//可以添加自定义categories
|
|
||||||
[JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
|
|
||||||
UIUserNotificationTypeSound |
|
|
||||||
UIUserNotificationTypeAlert)
|
|
||||||
categories:nil];
|
|
||||||
} else {
|
|
||||||
//categories 必须为nil
|
|
||||||
[JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
|
||||||
UIRemoteNotificationTypeSound |
|
|
||||||
UIRemoteNotificationTypeAlert)
|
|
||||||
categories:nil];
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
//categories 必须为nil
|
|
||||||
[JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
|
||||||
UIRemoteNotificationTypeSound |
|
|
||||||
UIRemoteNotificationTypeAlert)
|
|
||||||
categories:nil];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(void)registerForRemoteNotification{
|
||||||
|
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
|
||||||
|
//可以添加自定义categories
|
||||||
|
[JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
|
||||||
|
UIUserNotificationTypeSound |
|
||||||
|
UIUserNotificationTypeAlert)
|
||||||
|
categories:nil];
|
||||||
|
} else {
|
||||||
|
//categories 必须为nil
|
||||||
|
[JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
|
||||||
|
UIRemoteNotificationTypeSound |
|
||||||
|
UIRemoteNotificationTypeAlert)
|
||||||
|
categories:nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-(void)isPushStopped:(CDVInvokedUrlCommand*)command{
|
-(void)isPushStopped:(CDVInvokedUrlCommand*)command{
|
||||||
|
NSNumber *result;
|
||||||
NSNumber *result;
|
if ([[UIApplication sharedApplication] isRegisteredForRemoteNotifications]) {
|
||||||
if ([[UIApplication sharedApplication] isRegisteredForRemoteNotifications ]) {
|
result = @(0);
|
||||||
result=@(0);
|
}else{
|
||||||
}else{
|
result = @(1);
|
||||||
result=@(1);
|
}
|
||||||
}
|
[self hanleResultWithValue:result command:command];
|
||||||
CDVPluginResult * pushResult=[self pluginResultForValue:result];
|
|
||||||
if (pushResult) {
|
|
||||||
[self succeedWithPluginResult:pushResult withCallbackID:command.callbackId];
|
|
||||||
} else {
|
|
||||||
[self failWithCallbackID:command.callbackId];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void)initial:(CDVInvokedUrlCommand*)command{
|
-(void)initial:(CDVInvokedUrlCommand*)command{
|
||||||
//do nithng,because Cordova plugin use lazy load mode.
|
//do nithng,because Cordova plugin use lazy load mode.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __CORDOVA_4_0_0
|
#ifdef __CORDOVA_4_0_0
|
||||||
|
|
||||||
- (void)pluginInitialize {
|
- (void)pluginInitialize {
|
||||||
NSLog(@"### pluginInitialize ");
|
NSLog(@"### pluginInitialize ");
|
||||||
[self initNotifications];
|
[self initNotifications];
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView{
|
- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView{
|
||||||
NSLog(@"### initWithWebView ");
|
NSLog(@"### initWithWebView ");
|
||||||
if (self=[super initWithWebView:theWebView]) {
|
if (self=[super initWithWebView:theWebView]) {
|
||||||
[self initNotifications];
|
[self initNotifications];
|
||||||
|
}
|
||||||
}
|
return self;
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)initNotifications {
|
-(void)initNotifications {
|
||||||
|
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
|
||||||
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
|
[defaultCenter addObserver:self
|
||||||
[defaultCenter addObserver:self
|
selector:@selector(networkDidReceiveMessage:)
|
||||||
selector:@selector(networkDidReceiveMessage:)
|
name:kJPFNetworkDidReceiveMessageNotification
|
||||||
name:kJPFNetworkDidReceiveMessageNotification
|
object:nil];
|
||||||
object:nil];
|
|
||||||
|
[defaultCenter addObserver:self
|
||||||
[defaultCenter addObserver:self
|
selector:@selector(networkDidReceiveNotification:)
|
||||||
selector:@selector(networkDidReceiveNotification:)
|
name:kJPushPluginReceiveNotification
|
||||||
name:kJPushPluginReceiveNotification
|
object:nil];
|
||||||
object:nil];
|
|
||||||
|
if (_luanchOptions) {
|
||||||
if (_luanchOptions) {
|
NSDictionary *userInfo = [_luanchOptions
|
||||||
NSDictionary *userInfo = [_luanchOptions
|
valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
||||||
valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
if ([userInfo count] >0) {
|
||||||
if ([userInfo count] >0) {
|
NSError *error;
|
||||||
NSError *error;
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
|
||||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
|
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||||
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
if (!error) {
|
||||||
if (!error) {
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.openNotification',%@)",jsonString]];
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
});
|
||||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.openNotification',%@)",jsonString]];
|
|
||||||
});
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
|
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
|
||||||
NSArray *arguments=command.arguments;
|
NSArray *arguments = command.arguments;
|
||||||
if (!arguments||[arguments count]<2) {
|
NSString *alias;
|
||||||
|
NSArray *tags;
|
||||||
NSLog(@"#### setTagsWithAlias param is less");
|
if (!arguments || [arguments count] < 2) {
|
||||||
return ;
|
NSLog(@"#### setTagsWithAlias param is less");
|
||||||
}
|
return ;
|
||||||
NSString *alias=[arguments objectAtIndex:0];
|
}else{
|
||||||
NSArray *arrayTags=[arguments objectAtIndex:1];
|
alias = arguments[0];
|
||||||
|
tags = arguments[1];
|
||||||
NSLog(@"#### setTagsWithAlias alias is %@, tags is %@",alias,arrayTags);
|
}
|
||||||
|
|
||||||
NSSet* set=[NSSet setWithArray:arrayTags];
|
NSLog(@"#### setTagsWithAlias alias is %@, tags is %@",alias,tags);
|
||||||
[JPUSHService setTags:set
|
|
||||||
alias:alias
|
[JPUSHService setTags:[NSSet setWithArray:tags]
|
||||||
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
alias:alias
|
||||||
object:self];
|
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
||||||
|
object:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)setTags:(CDVInvokedUrlCommand *)command{
|
-(void)setTags:(CDVInvokedUrlCommand *)command{
|
||||||
|
|
||||||
|
|
||||||
NSArray *arguments=[command arguments];
|
|
||||||
NSString *tags=[arguments objectAtIndex:0];
|
|
||||||
|
|
||||||
NSLog(@"#### setTags %@",tags);
|
|
||||||
|
|
||||||
NSArray *array=[tags componentsSeparatedByString:@","];
|
NSArray *tags = command.arguments;
|
||||||
[JPUSHService setTags:[NSSet setWithArray:array]
|
|
||||||
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
NSLog(@"#### setTags %@",tags);
|
||||||
object:self];
|
|
||||||
|
[JPUSHService setTags:[NSSet setWithArray:tags]
|
||||||
|
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
||||||
|
object:self];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)setAlias:(CDVInvokedUrlCommand *)command{
|
-(void)setAlias:(CDVInvokedUrlCommand *)command{
|
||||||
|
|
||||||
NSArray *arguments=[command arguments];
|
NSLog(@"#### setAlias %@",command.arguments);
|
||||||
NSLog(@"#### setAlias %@",arguments);
|
[JPUSHService setAlias:command.arguments[0]
|
||||||
[JPUSHService setAlias:[arguments objectAtIndex:0]
|
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
||||||
callbackSelector:@selector(tagsWithAliasCallback:tags:alias:)
|
object:self];
|
||||||
object:self];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command{
|
-(void)getRegistrationID:(CDVInvokedUrlCommand*)command{
|
||||||
NSString* registrationID = [JPUSHService registrationID];
|
NSString* registrationID = [JPUSHService registrationID];
|
||||||
NSLog(@"### getRegistrationID %@",registrationID);
|
NSLog(@"### getRegistrationID %@",registrationID);
|
||||||
|
[self hanleResultWithValue:registrationID command:command];
|
||||||
CDVPluginResult *result=[self pluginResultForValue:registrationID];
|
|
||||||
if (result) {
|
|
||||||
[self succeedWithPluginResult:result withCallbackID:command.callbackId];
|
|
||||||
} else {
|
|
||||||
[self failWithCallbackID:command.callbackId];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias{
|
|
||||||
|
|
||||||
NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys:
|
|
||||||
[NSNumber numberWithInt:resultCode],@"resultCode",
|
|
||||||
tags==nil?[NSNull null]:[tags allObjects],@"tags",
|
|
||||||
alias==nil?[NSNull null]:alias,@"alias",nil];
|
|
||||||
NSMutableDictionary *data = [NSMutableDictionary dictionary];
|
|
||||||
[data setObject:[NSNumber numberWithInt:resultCode] forKey:@"resultCode"];
|
|
||||||
[data setObject:tags==nil?[NSNull null]:[tags allObjects] forKey:@"tags"];
|
|
||||||
[data setObject:alias==nil?[NSNull null]:alias forKey:@"alias"];
|
|
||||||
NSError *error;
|
|
||||||
|
|
||||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:0 error:&error];
|
|
||||||
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.setTagsWithAlias',%@)",jsonString]];
|
|
||||||
// [self writeJavascript:[NSString stringWithFormat:@"window.plugins.jPushPlugin.pushCallback('%@')",jsonString]];
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-(void)startLogPageView:(CDVInvokedUrlCommand*)command{
|
-(void)startLogPageView:(CDVInvokedUrlCommand*)command{
|
||||||
NSArray *arguments=command.arguments;
|
NSArray *arguments = command.arguments;
|
||||||
if (!arguments||[arguments count]<1) {
|
if (!arguments || [arguments count] < 1) {
|
||||||
NSLog(@"startLogPageView argument error");
|
NSLog(@"startLogPageView argument error");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
NSString * pageName=[arguments objectAtIndex:0];
|
NSString * pageName = arguments[0];
|
||||||
if (pageName) {
|
if (pageName) {
|
||||||
[JPUSHService startLogPageView:pageName];
|
[JPUSHService startLogPageView:pageName];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void)stopLogPageView:(CDVInvokedUrlCommand*)command{
|
-(void)stopLogPageView:(CDVInvokedUrlCommand*)command{
|
||||||
NSArray *arguments=command.arguments;
|
NSArray *arguments = command.arguments;
|
||||||
if (!arguments||[arguments count]<1) {
|
if (!arguments || [arguments count] < 1) {
|
||||||
NSLog(@"stopLogPageView argument error");
|
NSLog(@"stopLogPageView argument error");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
NSString * pageName=[arguments objectAtIndex:0];
|
NSString * pageName = arguments[0];
|
||||||
if (pageName) {
|
if (pageName) {
|
||||||
[JPUSHService stopLogPageView:pageName];
|
[JPUSHService stopLogPageView:pageName];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)beginLogPageView:(CDVInvokedUrlCommand*)command{
|
-(void)beginLogPageView:(CDVInvokedUrlCommand*)command{
|
||||||
NSArray *arguments=command.arguments;
|
NSArray *arguments = command.arguments;
|
||||||
if (!arguments||[arguments count]<2) {
|
if (!arguments || [arguments count] < 2) {
|
||||||
NSLog(@"beginLogPageView argument error");
|
NSLog(@"beginLogPageView argument error");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
NSString * pageName=[arguments objectAtIndex:0];
|
NSString * pageName = arguments[0];
|
||||||
int duration=[[arguments objectAtIndex:0]intValue];
|
int duration = [arguments[0] intValue];
|
||||||
if (pageName) {
|
if (pageName) {
|
||||||
[JPUSHService beginLogPageView:pageName duration:duration];
|
[JPUSHService beginLogPageView:pageName duration:duration];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void)setBadge:(CDVInvokedUrlCommand*)command{
|
-(void)setBadge:(CDVInvokedUrlCommand*)command{
|
||||||
NSArray *argument=command.arguments;
|
NSArray *argument = command.arguments;
|
||||||
if ([argument count]<1) {
|
if ([argument count] < 1) {
|
||||||
NSLog(@"setBadge argument error!");
|
NSLog(@"setBadge argument error!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NSNumber *badge=[argument objectAtIndex:0];
|
NSNumber *badge = argument[0];
|
||||||
[JPUSHService setBadge:[badge intValue]];
|
[JPUSHService setBadge:[badge intValue]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)resetBadge:(CDVInvokedUrlCommand*)command{
|
-(void)resetBadge:(CDVInvokedUrlCommand*)command{
|
||||||
[JPUSHService resetBadge];
|
[JPUSHService resetBadge];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand *)command{
|
-(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand *)command{
|
||||||
//
|
//
|
||||||
NSArray *argument=command.arguments;
|
NSArray *argument = command.arguments;
|
||||||
if ([argument count]<1) {
|
if ([argument count] < 1) {
|
||||||
NSLog(@"setBadge argument error!");
|
NSLog(@"setBadge argument error!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NSNumber *badge=[argument objectAtIndex:0];
|
NSNumber *badge = [argument objectAtIndex:0];
|
||||||
[UIApplication sharedApplication].applicationIconBadgeNumber=[badge intValue];
|
[UIApplication sharedApplication].applicationIconBadgeNumber = [badge intValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand *)command {
|
-(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand *)command {
|
||||||
NSInteger num = [UIApplication sharedApplication].applicationIconBadgeNumber;
|
NSInteger num = [UIApplication sharedApplication].applicationIconBadgeNumber;
|
||||||
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:num];
|
NSNumber *number = [NSNumber numberWithInteger:num];
|
||||||
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
[self hanleResultWithValue:number command:command];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command{
|
-(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command{
|
||||||
|
[JPUSHService setDebugMode];
|
||||||
[JPUSHService setDebugMode];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)setLogOFF:(CDVInvokedUrlCommand*)command{
|
-(void)setLogOFF:(CDVInvokedUrlCommand*)command{
|
||||||
|
[JPUSHService setLogOFF];
|
||||||
[JPUSHService setLogOFF];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)crashLogON:(CDVInvokedUrlCommand*)command{
|
||||||
|
[JPUSHService crashLogON];
|
||||||
- (void)failWithCallbackID:(NSString *)callbackID {
|
|
||||||
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
|
||||||
[self.commandDelegate sendPluginResult:result callbackId:callbackID];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)setLocalNotification:(CDVInvokedUrlCommand*)command{
|
||||||
|
NSArray *arguments = command.arguments;
|
||||||
- (void)succeedWithPluginResult:(CDVPluginResult *)result withCallbackID:(NSString *)callbackID {
|
NSDate *date = arguments[0] == [NSNull null] ? nil : [NSDate dateWithTimeIntervalSinceNow:[((NSString*)arguments[0]) intValue]];
|
||||||
[self.commandDelegate sendPluginResult:result callbackId:callbackID];
|
NSString *alertBody = arguments[1] == [NSNull null] ? nil : (NSString*)arguments[1];
|
||||||
|
int badge = arguments[2] == [NSNull null] ? 0 : [(NSString*)arguments[2] intValue];
|
||||||
|
NSString *idKey = arguments[3] == [NSNull null] ? nil : (NSString*)arguments[3];
|
||||||
|
NSDictionary *dict = arguments[4] == [NSNull null] ? nil : (NSDictionary*)arguments[4];
|
||||||
|
[JPUSHService setLocalNotification:date alertBody:alertBody badge:badge alertAction:nil identifierKey:idKey userInfo:dict soundName:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command{
|
||||||
|
[JPUSHService deleteLocalNotificationWithIdentifierKey:(NSString*)command.arguments[0]];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command{
|
||||||
|
[JPUSHService clearAllLocalNotifications];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)setLocation:(CDVInvokedUrlCommand*)command{
|
||||||
|
[JPUSHService setLatitude:[((NSString*)command.arguments[0]) doubleValue] longitude:[((NSString*)command.arguments[1]) doubleValue]];
|
||||||
|
}
|
||||||
|
|
||||||
- (CDVPluginResult *)pluginResultForValue:(id)value {
|
#pragma mark- 内部方法
|
||||||
|
+(void)setLaunchOptions:(NSDictionary *)theLaunchOptions{
|
||||||
CDVPluginResult *result;
|
_luanchOptions = theLaunchOptions;
|
||||||
if ([value isKindOfClass:[NSString class]]) {
|
|
||||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
|
[JPUSHService setDebugMode];
|
||||||
messageAsString:[value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
|
||||||
} else if ([value isKindOfClass:[NSNumber class]]) {
|
[JPushPlugin registerForRemoteNotification];
|
||||||
CFNumberType numberType = CFNumberGetType((CFNumberRef)value);
|
|
||||||
//note: underlyingly, BOOL values are typedefed as char
|
//read appkey and channel from PushConfig.plist
|
||||||
if (numberType == kCFNumberIntType || numberType == kCFNumberCharType) {
|
NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfigFileName ofType:@"plist"];
|
||||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:[value intValue]];
|
if (plistPath == nil) {
|
||||||
} else {
|
NSLog(@"error: PushConfig.plist not found");
|
||||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:[value doubleValue]];
|
assert(0);
|
||||||
}
|
}
|
||||||
} else if ([value isKindOfClass:[NSArray class]]) {
|
|
||||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:value];
|
NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
|
||||||
} else if ([value isKindOfClass:[NSDictionary class]]) {
|
NSString * appkey = [plistData valueForKey:JM_APP_KEY];
|
||||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:value];
|
NSString * channel = [plistData valueForKey:JM_APP_CHANNEL];
|
||||||
} else if ([value isKindOfClass:[NSNull class]]) {
|
NSNumber * isProduction = [plistData valueForKey:JM_APP_ISPRODUCTION];
|
||||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
||||||
} else {
|
if (!appkey || appkey.length == 0) {
|
||||||
NSLog(@"Cordova callback block returned unrecognized type: %@", NSStringFromClass([value class]));
|
NSLog(@"error: app key not found in PushConfig.plist ");
|
||||||
return nil;
|
assert(0);
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
[JPUSHService setupWithOption:_luanchOptions appKey:appkey
|
||||||
|
channel:channel apsForProduction:[isProduction boolValue] ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark 将参数返回给js
|
||||||
|
-(void)hanleResultWithValue:(id)value command:(CDVInvokedUrlCommand*)command{
|
||||||
|
CDVPluginResult *result = nil;
|
||||||
|
CDVCommandStatus status = CDVCommandStatus_OK;
|
||||||
|
|
||||||
|
if ([value isKindOfClass:[NSString class]]) {
|
||||||
|
value = [value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
} else if ([value isKindOfClass:[NSNull class]]) {
|
||||||
|
value = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([value isKindOfClass:[NSObject class]]) {
|
||||||
|
result = [CDVPluginResult resultWithStatus:status messageAsString:value];//NSObject 类型都可以
|
||||||
|
} else {
|
||||||
|
NSLog(@"Cordova callback block returned unrecognized type: %@", NSStringFromClass([value class]));
|
||||||
|
result = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
||||||
|
}
|
||||||
|
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark 设置标签及别名回调
|
||||||
|
-(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias{
|
||||||
|
|
||||||
|
NSDictionary *dict = @{@"resultCode":[NSNumber numberWithInt:resultCode],
|
||||||
|
@"tags" :tags == nil ? [NSNull null] : [tags allObjects],
|
||||||
|
@"alias" :alias == nil ? [NSNull null] : alias
|
||||||
|
};
|
||||||
|
NSError *error;
|
||||||
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:0 error:&error];
|
||||||
|
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.setTagsWithAlias',%@)",jsonString]];
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)networkDidReceiveMessage:(NSNotification *)notification {
|
- (void)networkDidReceiveMessage:(NSNotification *)notification {
|
||||||
|
if (notification) {
|
||||||
NSDictionary *userInfo = [notification userInfo];
|
NSDictionary *userInfo = [notification userInfo];
|
||||||
//NSLog(@"%@",userInfo);
|
//NSLog(@"%@",userInfo);
|
||||||
|
|
||||||
NSError *error;
|
NSError *error;
|
||||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
|
||||||
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
//NSLog(@"%@",jsonString);
|
//NSLog(@"%@",jsonString);
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
|
||||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.receiveMessage',%@)",jsonString]];
|
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.receiveMessage',%@)",jsonString]];
|
||||||
|
|
||||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"window.plugins.jPushPlugin.receiveMessageIniOSCallback('%@')",jsonString]];
|
[self.commandDelegate evalJs:[NSString stringWithFormat:@"window.plugins.jPushPlugin.receiveMessageIniOSCallback('%@')",jsonString]];
|
||||||
|
|
||||||
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)networkDidReceiveNotification:(id)notification{
|
-(void)networkDidReceiveNotification:(id)notification{
|
||||||
|
|
||||||
NSError *error;
|
NSError *error;
|
||||||
NSDictionary *userInfo = [notification object];
|
NSDictionary *userInfo = [notification object];
|
||||||
|
|
||||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
|
||||||
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||||
switch ([UIApplication sharedApplication].applicationState) {
|
NSLog(@"%ld",(long)[UIApplication sharedApplication].applicationState);
|
||||||
case UIApplicationStateActive:
|
switch ([UIApplication sharedApplication].applicationState) {
|
||||||
{
|
case UIApplicationStateActive:
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
{
|
||||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.receiveNotification',%@)",jsonString]];
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
});
|
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.receiveNotification',%@)",jsonString]];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case UIApplicationStateInactive:
|
||||||
|
case UIApplicationStateBackground:
|
||||||
|
{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.openNotification',%@)",jsonString]];
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case UIApplicationStateInactive:
|
|
||||||
case UIApplicationStateBackground:
|
|
||||||
{
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
[self.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.openNotification',%@)",jsonString]];
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//do nothing
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
+244
-237
@@ -5,334 +5,341 @@ var JPushPlugin = function(){
|
|||||||
|
|
||||||
//private plugin function
|
//private plugin function
|
||||||
|
|
||||||
JPushPlugin.prototype.receiveMessage={}
|
JPushPlugin.prototype.receiveMessage = {}
|
||||||
JPushPlugin.prototype.openNotification={}
|
JPushPlugin.prototype.openNotification = {}
|
||||||
JPushPlugin.prototype.receiveNotification={}
|
JPushPlugin.prototype.receiveNotification = {}
|
||||||
|
|
||||||
|
|
||||||
JPushPlugin.prototype.isPlatformIOS = function(){
|
JPushPlugin.prototype.isPlatformIOS = function() {
|
||||||
return device.platform == "iPhone" || device.platform == "iPad" || device.platform == "iPod touch" || device.platform == "iOS"
|
var isPlatformIOS = device.platform == "iPhone"
|
||||||
|
|| device.platform == "iPad"
|
||||||
|
|| device.platform == "iPod touch"
|
||||||
|
|| device.platform == "iOS";
|
||||||
|
return isPlatformIOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.error_callback = function(msg){
|
JPushPlugin.prototype.error_callback = function(msg) {
|
||||||
console.log("Javascript Callback Error: " + msg)
|
console.log("Javascript Callback Error: " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.call_native = function(name, args, callback){
|
JPushPlugin.prototype.call_native = function(name, args, callback) {
|
||||||
|
ret = cordova.exec(callback, this.error_callback, 'JPushPlugin', name, args);
|
||||||
ret = cordova.exec(callback,this.error_callback,'JPushPlugin',name,args);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public plugin function
|
//public plugin function
|
||||||
|
|
||||||
JPushPlugin.prototype.startLogPageView = function(pageName){
|
JPushPlugin.prototype.startLogPageView = function(pageName) {
|
||||||
if(this.isPlatformIOS()){
|
if(this.isPlatformIOS()) {
|
||||||
this.call_native( "startLogPageView",[pageName],null);
|
this.call_native("startLogPageView", [pageName], null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.stopLogPageView = function(pageName){
|
JPushPlugin.prototype.stopLogPageView = function(pageName) {
|
||||||
if(this.isPlatformIOS()){
|
if(this.isPlatformIOS()) {
|
||||||
this.call_native( "stopLogPageView",[pageName],null);
|
this.call_native("stopLogPageView", [pageName], null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.beginLogPageView = function(pageName,duration){
|
JPushPlugin.prototype.beginLogPageView = function(pageName, duration) {
|
||||||
if(this.isPlatformIOS()){
|
if(this.isPlatformIOS()) {
|
||||||
this.call_native( "beginLogPageView",[pageName,duration],null);
|
this.call_native("beginLogPageView", [pageName, duration], null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.setApplicationIconBadgeNumber = function(badge){
|
|
||||||
if(this.isPlatformIOS()){
|
|
||||||
this.call_native( "setApplicationIconBadgeNumber",[badge],null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JPushPlugin.prototype.getApplicationIconBadgeNumber = function(callback){
|
|
||||||
if(this.isPlatformIOS()){
|
|
||||||
this.call_native( "getApplicationIconBadgeNumber",[],callback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JPushPlugin.prototype.setTagsWithAlias = function(tags,alias){
|
JPushPlugin.prototype.setApplicationIconBadgeNumber = function(badge) {
|
||||||
try{
|
if(this.isPlatformIOS()) {
|
||||||
if(tags==null){
|
this.call_native("setApplicationIconBadgeNumber", [badge], null);
|
||||||
this.setAlias(alias);
|
}
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
if(alias==null){
|
JPushPlugin.prototype.getApplicationIconBadgeNumber = function(callback) {
|
||||||
this.setTags(tags);
|
if(this.isPlatformIOS()) {
|
||||||
|
this.call_native("getApplicationIconBadgeNumber", [], callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.setTagsWithAlias = function(tags, alias) {
|
||||||
|
try {
|
||||||
|
if(tags == null) {
|
||||||
|
this.setAlias(alias);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(alias == null) {
|
||||||
|
this.setTags(tags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var arrayTagWithAlias=[tags];
|
var arrayTagWithAlias = [tags];
|
||||||
arrayTagWithAlias.unshift(alias);
|
arrayTagWithAlias.unshift(alias);
|
||||||
this.call_native( "setTagsWithAlias", arrayTagWithAlias,null);
|
this.call_native("setTagsWithAlias", arrayTagWithAlias, null);
|
||||||
}
|
} catch(exception) {
|
||||||
catch(exception){
|
|
||||||
console.log(exception);
|
console.log(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.setTags = function(tags){
|
|
||||||
|
JPushPlugin.prototype.setTags = function(tags) {
|
||||||
try{
|
try {
|
||||||
this.call_native("setTags",tags,null);
|
this.call_native("setTags", tags, null);
|
||||||
}
|
} catch(exception) {
|
||||||
catch(exception){
|
|
||||||
console.log(exception);
|
console.log(exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.setAlias = function(alias){
|
JPushPlugin.prototype.setAlias = function(alias) {
|
||||||
try{
|
try {
|
||||||
this.call_native("setAlias",[alias],null);
|
this.call_native("setAlias", [alias], null);
|
||||||
}
|
} catch(exception) {
|
||||||
catch(exception){
|
|
||||||
console.log(exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JPushPlugin.prototype.getRegistrationID = function(callback){
|
|
||||||
|
|
||||||
try{
|
|
||||||
var data=[];
|
|
||||||
this.call_native("getRegistrationID",[data],callback);
|
|
||||||
}
|
|
||||||
catch(exception){
|
|
||||||
console.log(exception);
|
console.log(exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.setBadge = function(value){
|
JPushPlugin.prototype.getRegistrationID = function(callback) {
|
||||||
|
try {
|
||||||
if(this.isPlatformIOS()){
|
var data = [];
|
||||||
try{
|
this.call_native("getRegistrationID", [data], callback);
|
||||||
this.call_native("setBadge",[value],null);
|
} catch(exception) {
|
||||||
}
|
console.log(exception);
|
||||||
catch(exception){
|
}
|
||||||
console.log(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.resetBadge = function(){
|
|
||||||
|
JPushPlugin.prototype.setBadge = function(value) {
|
||||||
if(this.isPlatformIOS()){
|
if(this.isPlatformIOS()) {
|
||||||
try{
|
try {
|
||||||
var data=[];
|
this.call_native("setBadge", [value], null);
|
||||||
this.call_native("resetBadge",[data],null);
|
} catch(exception) {
|
||||||
}
|
console.log(exception);
|
||||||
catch(exception){
|
}
|
||||||
console.log(exception);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.resetBadge = function() {
|
||||||
|
if(this.isPlatformIOS()) {
|
||||||
|
try {
|
||||||
|
var data = [];
|
||||||
|
this.call_native("resetBadge", [data], null);
|
||||||
|
} catch(exception) {
|
||||||
|
console.log(exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.setDebugModeFromIos = function() {
|
||||||
|
if(this.isPlatformIOS()) {
|
||||||
|
var data = [];
|
||||||
|
this.call_native("setDebugModeFromIos", [data], null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.setLogOFF = function() {
|
||||||
|
if(this.isPlatformIOS()) {
|
||||||
|
var data = [];
|
||||||
|
this.call_native("setLogOFF", [data], null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.setCrashLogON = function() {
|
||||||
|
if (this.isPlatformIOS()) {
|
||||||
|
var data = [];
|
||||||
|
this.call_native("crashLogON", [data], null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.setDebugModeFromIos = function(){
|
|
||||||
if(this.isPlatformIOS()){
|
|
||||||
var data=[];
|
|
||||||
this.call_native("setDebugModeFromIos",[data],null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
JPushPlugin.prototype.addLocalNotificationForIOS = function(delayTime, content,
|
||||||
|
badge, notificationID, extras) {
|
||||||
|
if (this.isPlatformIOS()) {
|
||||||
|
var data = [delayTime, content, badge, notificationID, extras];
|
||||||
|
this.call_native("setLocalNotification", data, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.setLogOFF = function(){
|
|
||||||
if(this.isPlatformIOS()){
|
JPushPlugin.prototype.deleteLocalNotificationWithIdentifierKeyInIOS = function(
|
||||||
var data=[];
|
identifierKey) {
|
||||||
this.call_native("setLogOFF",[data],null);
|
if (this.isPlatformIOS()) {
|
||||||
}
|
var data = [identifierKey];
|
||||||
|
this.call_native("deleteLocalNotificationWithIdentifierKey", data, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.receiveMessageIniOSCallback = function(data){
|
|
||||||
try{
|
JPushPlugin.prototype.clearAllLocalNotifications = function(){
|
||||||
console.log("JPushPlugin:receiveMessageIniOSCallback--data:"+data);
|
if (this.isPlatformIOS()) {
|
||||||
|
var data = [];
|
||||||
|
this.call_native("clearAllLocalNotifications", data, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.setLocation = function(latitude, longitude){
|
||||||
|
if (this.isPlatformIOS()) {
|
||||||
|
var data = [latitude, longitude];
|
||||||
|
this.call_native("setLocation", data, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.receiveMessageIniOSCallback = function(data) {
|
||||||
|
try {
|
||||||
|
console.log("JPushPlugin:receiveMessageIniOSCallback--data:" + data);
|
||||||
var bToObj = JSON.parse(data);
|
var bToObj = JSON.parse(data);
|
||||||
var content = bToObj.content;
|
var content = bToObj.content;
|
||||||
console.log(content);
|
console.log(content);
|
||||||
}
|
} catch(exception) {
|
||||||
catch(exception){
|
console.log("JPushPlugin:receiveMessageIniOSCallback" + exception);
|
||||||
console.log("JPushPlugin:receiveMessageIniOSCallback"+exception);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.receiveMessageInAndroidCallback = function(data){
|
|
||||||
try{
|
JPushPlugin.prototype.receiveMessageInAndroidCallback = function(data) {
|
||||||
|
try {
|
||||||
console.log("JPushPlugin:receiveMessageInAndroidCallback");
|
console.log("JPushPlugin:receiveMessageInAndroidCallback");
|
||||||
var bToObj = JSON.parse(data);
|
data = JSON.stringify(data);
|
||||||
this.receiveMessage=bToObj
|
var bToObj = JSON.parse(data);
|
||||||
cordova.fireDocumentEvent('jpush.receiveMessage',null);
|
this.receiveMessage = bToObj
|
||||||
//console.log(data);
|
cordova.fireDocumentEvent('jpush.receiveMessage', null);
|
||||||
//var message = bToObj.message;
|
} catch(exception) {
|
||||||
//var extras = bToObj.extras;
|
console.log("JPushPlugin:pushCallback " + exception);
|
||||||
|
|
||||||
//console.log(message);
|
|
||||||
//console.log(extras['cn.jpush.android.MSG_ID']);
|
|
||||||
//console.log(extras['cn.jpush.android.CONTENT_TYPE']);
|
|
||||||
//console.log(extras['cn.jpush.android.EXTRA']);
|
|
||||||
}
|
|
||||||
catch(exception){
|
|
||||||
console.log("JPushPlugin:pushCallback "+exception);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
JPushPlugin.prototype.openNotificationInAndroidCallback = function(data) {
|
||||||
JPushPlugin.prototype.openNotificationInAndroidCallback = function(data){
|
try {
|
||||||
try{
|
|
||||||
console.log("JPushPlugin:openNotificationInAndroidCallback");
|
console.log("JPushPlugin:openNotificationInAndroidCallback");
|
||||||
var bToObj = JSON.parse(data);
|
data = JSON.stringify(data);
|
||||||
this.openNotification=bToObj;
|
var bToObj = JSON.parse(data);
|
||||||
cordova.fireDocumentEvent('jpush.openNotification',null);
|
this.openNotification = bToObj;
|
||||||
|
cordova.fireDocumentEvent('jpush.openNotification', null);
|
||||||
//console.log(data);
|
} catch(exception) {
|
||||||
//var bToObj = JSON.parse(data);
|
|
||||||
//var alert = bToObj.alert;
|
|
||||||
//var extras = bToObj.extras;
|
|
||||||
//console.log(alert);
|
|
||||||
|
|
||||||
//console.log(extras['cn.jpush.android.MSG_ID']);
|
|
||||||
//console.log(extras['app']);
|
|
||||||
//console.log(extras['cn.jpush.android.NOTIFICATION_CONTENT_TITLE']);
|
|
||||||
//console.log(extras['cn.jpush.android.EXTRA']);
|
|
||||||
//console.log(extras['cn.jpush.android.PUSH_ID']);
|
|
||||||
//console.log(extras['cn.jpush.android.NOTIFICATION_ID']);
|
|
||||||
//console.log("JPushPlugin:openNotificationCallback is ready");
|
|
||||||
}
|
|
||||||
catch(exception){
|
|
||||||
console.log(exception);
|
console.log(exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.receiveNotificationInAndroidCallback = function(data){
|
|
||||||
|
JPushPlugin.prototype.receiveNotificationInAndroidCallback = function(data) {
|
||||||
try{
|
try{
|
||||||
console.log("JPushPlugin:receiveNotificationInAndroidCallback");
|
console.log("JPushPlugin:receiveNotificationInAndroidCallback");
|
||||||
var bToObj = JSON.parse(data);
|
data = JSON.stringify(data);
|
||||||
this.receiveNotification=bToObj;
|
var bToObj = JSON.parse(data);
|
||||||
cordova.fireDocumentEvent('jpush.receiveNotification',null);
|
this.receiveNotification = bToObj;
|
||||||
|
cordova.fireDocumentEvent('jpush.receiveNotification', null);
|
||||||
//console.log(data);
|
} catch(exception) {
|
||||||
//var bToObj = JSON.parse(data);
|
|
||||||
//var alert = bToObj.alert;
|
|
||||||
//var extras = bToObj.extras;
|
|
||||||
//console.log(alert);
|
|
||||||
|
|
||||||
//console.log(extras['cn.jpush.android.MSG_ID']);
|
|
||||||
//console.log(extras['app']);
|
|
||||||
//console.log(extras['cn.jpush.android.NOTIFICATION_CONTENT_TITLE']);
|
|
||||||
//console.log(extras['cn.jpush.android.EXTRA']);
|
|
||||||
//console.log(extras['cn.jpush.android.PUSH_ID']);
|
|
||||||
//console.log(extras['cn.jpush.android.NOTIFICATION_ID']);
|
|
||||||
//console.log("JPushPlugin:openNotificationCallback is ready");
|
|
||||||
}
|
|
||||||
catch(exception){
|
|
||||||
console.log(exception);
|
console.log(exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//android single
|
//android single
|
||||||
|
|
||||||
JPushPlugin.prototype.setBasicPushNotificationBuilder = function(){
|
JPushPlugin.prototype.setBasicPushNotificationBuilder = function() {
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
data=[]
|
data = [];
|
||||||
this.call_native("setBasicPushNotificationBuilder",data,null);
|
this.call_native("setBasicPushNotificationBuilder", data, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.setCustomPushNotificationBuilder = function(){
|
JPushPlugin.prototype.setCustomPushNotificationBuilder = function() {
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
data=[];
|
data = [];
|
||||||
this.call_native("setCustomPushNotificationBuilder",data,null);
|
this.call_native("setCustomPushNotificationBuilder", data, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.stopPush = function(){
|
JPushPlugin.prototype.stopPush = function() {
|
||||||
data=[];
|
data = [];
|
||||||
this.call_native("stopPush",data,null);
|
this.call_native("stopPush", data, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.resumePush = function(){
|
JPushPlugin.prototype.resumePush = function() {
|
||||||
data=[]
|
data = [];
|
||||||
this.call_native("resumePush",data,null);
|
this.call_native("resumePush", data, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
JPushPlugin.prototype.setDebugMode = function(mode){
|
|
||||||
|
JPushPlugin.prototype.setDebugMode = function(mode) {
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
this.call_native("setDebugMode",[mode],null);
|
this.call_native("setDebugMode", [mode], null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//setDebugMode
|
//setDebugMode
|
||||||
JPushPlugin.prototype.clearAllNotification = function(){
|
JPushPlugin.prototype.clearAllNotification = function() {
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
data=[]
|
data = [];
|
||||||
this.call_native("clearAllNotification",data,null);
|
this.call_native("clearAllNotification", data, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.clearNotificationById = function(notificationId){
|
JPushPlugin.prototype.clearNotificationById = function(notificationId) {
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
data=[]
|
data = [];
|
||||||
this.call_native("clearNotificationById",[notificationId],null);
|
this.call_native("clearNotificationById", [notificationId], null);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JPushPlugin.prototype.setLatestNotificationNum = function(num){
|
|
||||||
if(device.platform == "Android") {
|
|
||||||
this.call_native("setLatestNotificationNum",[num],null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.isPushStopped = function(callback){
|
JPushPlugin.prototype.setLatestNotificationNum = function(num) {
|
||||||
|
|
||||||
data=[];
|
|
||||||
this.call_native("isPushStopped",data,callback)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
JPushPlugin.prototype.init = function(){
|
|
||||||
if(this.isPlatformIOS()){
|
|
||||||
var data=[];
|
|
||||||
this.call_native("initial",data,null);
|
|
||||||
}else{
|
|
||||||
data=[];
|
|
||||||
this.call_native("init",data,null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
JPushPlugin.prototype.setDebugMode = function(mode){
|
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
this.call_native("setDebugMode",[mode],null);
|
this.call_native("setLatestNotificationNum", [num], null);
|
||||||
}
|
|
||||||
}
|
|
||||||
JPushPlugin.prototype.addLocalNotification = function(builderId,content,title,notificaitonID,broadcastTime,extras){
|
|
||||||
if(device.platform == "Android") {
|
|
||||||
data=[builderId,content,title,notificaitonID,broadcastTime,extras];
|
|
||||||
this.call_native("addLocalNotification",data,null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JPushPlugin.prototype.removeLocalNotification = function(notificationID){
|
|
||||||
if(device.platform == "Android") {
|
|
||||||
this.call_native("removeLocalNotification",[notificationID],null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JPushPlugin.prototype.clearLocalNotifications = function(){
|
|
||||||
if(device.platform == "Android") {
|
|
||||||
data=[]
|
|
||||||
this.call_native("clearLocalNotifications",data,null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPushPlugin.prototype.reportNotificationOpened = function(msgID){
|
JPushPlugin.prototype.isPushStopped = function(callback) {
|
||||||
|
data = [];
|
||||||
|
this.call_native("isPushStopped", data, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.init = function() {
|
||||||
|
if(this.isPlatformIOS()) {
|
||||||
|
var data = [];
|
||||||
|
this.call_native("initial", data, null);
|
||||||
|
} else {
|
||||||
|
data = [];
|
||||||
|
this.call_native("init", data, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.setDebugMode = function(mode) {
|
||||||
if(device.platform == "Android") {
|
if(device.platform == "Android") {
|
||||||
|
this.call_native("setDebugMode", [mode], null);
|
||||||
this.call_native("reportNotificationOpened",[msgID],null);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.addLocalNotification = function(builderId, content, title,
|
||||||
|
notificaitonID, broadcastTime, extras) {
|
||||||
|
if(device.platform == "Android") {
|
||||||
|
data = [builderId, content, title, notificaitonID, broadcastTime, extras];
|
||||||
|
this.call_native("addLocalNotification", data, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.removeLocalNotification = function(notificationID) {
|
||||||
|
if(device.platform == "Android") {
|
||||||
|
this.call_native("removeLocalNotification", [notificationID], null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.clearLocalNotifications = function() {
|
||||||
|
if(device.platform == "Android") {
|
||||||
|
data = [];
|
||||||
|
this.call_native("clearLocalNotifications", data, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JPushPlugin.prototype.reportNotificationOpened = function(msgID) {
|
||||||
|
if(device.platform == "Android") {
|
||||||
|
this.call_native("reportNotificationOpened", [msgID], null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*是否开启统计分析功能,用于“用户使用时长”,“活跃用户”,“用户打开次数”的统计,并上报到服务器上,
|
||||||
|
*在 Portal 上展示给开发者。
|
||||||
|
**/
|
||||||
|
JPushPlugin.prototype.setStatisticsOpen = function(mode) {
|
||||||
|
if(device.platform == "Android") {
|
||||||
|
this.call_native("setStatisticsOpen", [mode], null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//iOS single
|
//iOS single
|
||||||
|
|
||||||
|
if(!window.plugins) {
|
||||||
if(!window.plugins){
|
|
||||||
window.plugins = {};
|
window.plugins = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!window.plugins.jPushPlugin){
|
if(!window.plugins.jPushPlugin) {
|
||||||
window.plugins.jPushPlugin = new JPushPlugin();
|
window.plugins.jPushPlugin = new JPushPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = new JPushPlugin();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = new JPushPlugin();
|
||||||
|
|||||||
Reference in New Issue
Block a user