jpush-phonegap-plugin
Advanced tools
Comparing version 2.1.1 to 2.1.3
## Android API简介 | ||
### 接收通知时获得通知的信息 | ||
- 内容 | ||
window.plugins.jPushPlugin.receiveNotification.alert; | ||
- 标题 | ||
window.plugins.jPushPlugin.receiveNotification.title; | ||
- 附加字段 | ||
window.plugins.jPushPlugin.receiveNotification.extras.yourKey; | ||
### 打开通知时获得通知的信息 | ||
- 内容 | ||
window.plugins.jPushPlugin.openNotification.alert; | ||
- 标题 | ||
window.plugins.jPushPlugin.openNotification.title; | ||
- 附加字段 | ||
window.plugins.jPushPlugin.openNotification.extras.yourKey; | ||
### 收到自定义消息时获得通知的信息 | ||
- 内容 | ||
window.plugins.jPushPlugin.openNotification.message; | ||
- 附加字段 | ||
window.plugins.jPushPlugin.openNotification.extras.yourKey; | ||
### 获取集成日志 | ||
@@ -9,3 +33,3 @@ | ||
用于开启调试模式,可以查看集成 JPush 过程中的 Log,如果集成失败,可方便定位问题所在 | ||
用于开启调试模式,可以查看集成 JPush 过程中的 Log,如果集成失败,可方便定位问题所在。 | ||
@@ -27,3 +51,3 @@ ##### 接口定义 | ||
用于 Android 收到应用内消息的回调函数(请注意和通知的区别),该函数不需要主动调用 | ||
用于 Android 收到应用内消息的回调函数(请注意和通知的区别),该函数不需要主动调用。 | ||
@@ -35,4 +59,5 @@ ##### 接口定义 | ||
##### 参数说明 | ||
- data 接收到的 js 字符串,包含的 key:value 请进入该函数体查看 | ||
- data 接收到的 js 字符串,包含的 key:value 请进入该函数体查看。 | ||
##### 代码示例 | ||
@@ -42,5 +67,4 @@ | ||
当点击 Android 手机的通知栏进入应用程序时,会调用这个函数,这个函数不需要主动调用,是作为回调函数来用的 | ||
当点击 Android 手机的通知栏进入应用程序时,会调用这个函数,这个函数不需要主动调用,是作为回调函数来用的。 | ||
##### 接口定义 | ||
@@ -51,2 +75,3 @@ | ||
##### 参数说明 | ||
- data js字符串 | ||
@@ -59,7 +84,7 @@ | ||
#### API - onResume / onPause | ||
这是一个 android local api,不是 js 的 API,请注意 | ||
这是一个 Android Local API,不是 js 的 API,请注意 | ||
本 API 用于“用户使用时长”,“活跃用户”,“用户打开次数”的统计,并上报到服务器,在 Portal 上展示给开发者。 | ||
####接口定义 | ||
@@ -69,5 +94,7 @@ | ||
public static void onPause(final Activity activity) | ||
####参数说明 | ||
+ Activity activity 当前所在的 Activity。 | ||
+ Activity 当前所在的 Activity。 | ||
####调用说明 | ||
@@ -84,2 +111,3 @@ | ||
} | ||
@Override | ||
@@ -101,5 +129,6 @@ protected void onPause() { | ||
#### 参数说明 | ||
- boolean | ||
-true : 打开统计分析功能 | ||
-false: 关闭统计分析功能 | ||
- true : 打开统计分析功能 | ||
- false: 关闭统计分析功能 | ||
@@ -110,3 +139,2 @@ #### API - reportNotificationOpened | ||
##### 接口定义 | ||
@@ -118,3 +146,3 @@ | ||
- msgID | ||
-收到的通知或者自定义消息的 id | ||
- 收到的通知或者自定义消息的 id | ||
@@ -128,3 +156,3 @@ | ||
此 API 提供清除通知的功能,包括:清除所有 JPush 展现的通知(不包括非 JPush SDK 展现的) | ||
此 API 提供清除通知的功能,包括:清除所有 JPush 展现的通知(不包括非 JPush SDK 展现的)。 | ||
@@ -146,5 +174,5 @@ | ||
- setBasicPushNotificationBuilder | ||
- Basic 用于定制 Android Notification 里的 defaults / flags / icon 等基础样式(行为) | ||
- Basic 用于定制 Android Notification 里的 defaults / flags / icon 等基础样式(行为)。 | ||
- setCustomPushNotificationBuilder | ||
- 继承 Basic 进一步让开发者定制 Notification Layout | ||
- 继承 Basic 进一步让开发者定制 Notification Layout。 | ||
@@ -182,10 +210,10 @@ 如果不调用此方法定制,则极光 Push SDK 默认的通知栏样式是:Android 标准的通知栏提示。 | ||
本地通知 API 不依赖于网络,无网条件下依旧可以触发 | ||
本地通知 API 不依赖于网络,无网条件下依旧可以触发。 | ||
本地通知与网络推送的通知是相互独立的,不受保留最近通知条数上限的限制 | ||
本地通知与网络推送的通知是相互独立的,不受保留最近通知条数上限的限制。 | ||
本地通知的定时时间是自发送时算起的,不受中间关机等操作的影响 | ||
本地通知的定时时间是自发送时算起的,不受中间关机等操作的影响。 | ||
三个接口的功能分别为:添加一个本地通知,删除一个本地通知,删除所有的本地通知 | ||
三个接口的功能分别为:添加一个本地通知,删除一个本地通知,删除所有的本地通知。 | ||
@@ -201,7 +229,7 @@ #####接口定义 | ||
- builderId 设置本地通知样式 | ||
- content 设置本地通知的 content | ||
- title 设置本地通知的 title | ||
- notificaitonID 设置本地通知的 ID | ||
- broadcastTime 设置本地通知触发时间,为距离当前时间的数值,单位是毫秒 | ||
- extras 设置额外的数据信息 extras 为 json 字符串 | ||
- builderId 设置本地通知样式。 | ||
- content 设置本地通知的 content。 | ||
- title 设置本地通知的 title。 | ||
- notificaitonID 设置本地通知的 ID。 | ||
- broadcastTime 设置本地通知触发时间,为距离当前时间的数值,单位是毫秒。 | ||
- extras 设置额外的数据信息 extras 为 json 字符串。 |
@@ -1,12 +0,20 @@ | ||
#Android 手工安装 | ||
#Android 手动安装 | ||
下载 JPush PhoneGap 插件,并解压缩,标记插件目录为:`$JPUSH_PLUGIN_DIR` | ||
1. 复制:`$JPUSH_PLUGIN_DIR`/src/android/*.java 到 cn/jpush/phonega/ 目录下(即:cn.jpush.phonegap 的包下) | ||
2. 复制:`$JPUSH_PLUGIN_DIR`/src/android/armeabi/libjpush.so 到 lib/armeabi/ | ||
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/ | ||
5. 复制:`$JPUSH_PLUGIN_DIR`/src/android/jpush_notification_icon.png 到 res/drawable/ | ||
6. 修改 AndroidManifest.xml 在 manifest 节点下添加以下权限 | ||
1. 复制:$JPUSH_PLUGIN_DIR/src/android/*.java 到 cn/jpush/phonega/ 目录下(即:cn.jpush.phonegap 的包下) | ||
2. 复制:$JPUSH_PLUGIN_DIR/src/android/armeabi/libjpush.so 到 lib/armeabi/ | ||
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/ | ||
5. 复制:$JPUSH_PLUGIN_DIR/src/android/jpush_notification_icon.png 到 res/drawable/ | ||
6. 复制:$JPUSH_PLUGIN_DIR/www/JPushPlugin.js 到 assets/www/plugins/cn.jpush.phonegap.JPushPlugin.www/ | ||
和 platform_www/plugins/cn.jpush.phonegap.JPushPlugin/www/ | ||
并在 JPushPlugin.js 文件的代码外添加: | ||
cordova.define("cn.jpush.phonegap.JPushPlugin.JPushPlugin", function(require, exports, module) { | ||
// 代码 | ||
}); | ||
7. 修改 AndroidManifest.xml 在 manifest 节点下添加以下权限 | ||
<!-- Required 一些系统要求的权限,如访问网络等--> | ||
@@ -13,0 +21,0 @@ <uses-permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"/> |
@@ -1,2 +0,2 @@ | ||
### iOS手工安装 | ||
### iOS手动安装 | ||
@@ -3,0 +3,0 @@ 下载 JPush PhoneGap 插件,并解压缩,标记插件目录为:`$JPUSH_PLUGIN_DIR` |
{ | ||
"name": "jpush-phonegap-plugin", | ||
"version": "2.1.1", | ||
"version": "2.1.3", | ||
"description": "JPush for cordova plugin", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -39,4 +39,10 @@ ## JPush PhoneGap/Cordova Plugin ## | ||
cordova plugin add https://github.com/jpush/jpush-phonegap-plugin.git --variable API_KEY=your_jpush_appkey | ||
通过 cordova plugins 安装,要求 phonegap/cordova CLI 5.0+ (current stable v2.1.1) | ||
cordova plugin add jpush-phonegap-plugin --variable API_KEY=your_jpush_appkey | ||
直接通过 url 安装(unstable) | ||
cordova plugin add https://github.com/jpush/jpush-phonegap-plugin.git --variable API_KEY=your_jpush_appkey | ||
方法二:下载到本地再安装 | ||
@@ -61,10 +67,10 @@ | ||
### Android 手工安装 | ||
### Android 手动安装 | ||
[Android 手工安装文档地址](document/Android_handle_install.md) | ||
[Android 手动安装文档地址](document/Android_handle_install.md) | ||
### iOS 手工安装 | ||
### iOS 手动安装 | ||
[IOS手工安装文档地址](document/iOS_handle_install.md) | ||
[IOS手动安装文档地址](document/iOS_handle_install.md) | ||
@@ -117,2 +123,4 @@ | ||
event - jpush.setTagsWithAlias //三个方法都是触发该回调事件 | ||
+ 获取点击通知内容 | ||
@@ -137,6 +145,7 @@ | ||
event - jpush.receiveMessage | ||
//推荐使用事件的方式传递,但同时保留了 receiveMessageIniOSCallback 的回调函数,兼容以前的代码 | ||
window.plugins.jPushPlugin.receiveMessageIniOSCallback(data) | ||
event - jpush.receiveMessage | ||
+ 页面的统计 | ||
@@ -157,3 +166,4 @@ | ||
window.plugins.JPushPlugin.addLocalNotificationForIOS(delayTime, content, badge, notificationID, extras) | ||
window.plugins.JPushPlugin.addLocalNotificationForIOS(delayTime, content, | ||
badge, notificationID, extras) | ||
window.plugins.JPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS() | ||
@@ -233,4 +243,3 @@ window.plugins.JPushPlugin.clearAllLocalNotifications() | ||
###更多 | ||
[ JPush 官网文档](http://docs.jpush.io/) | ||
[JPush 官网文档](http://docs.jpush.io/) |
@@ -30,34 +30,38 @@ | ||
//public plugin function | ||
JPushPlugin.prototype.startLogPageView = function(pageName) { | ||
// public methods | ||
JPushPlugin.prototype.init = function() { | ||
if(this.isPlatformIOS()) { | ||
this.call_native("startLogPageView", [pageName], null); | ||
} | ||
var data = []; | ||
this.call_native("initial", data, null); | ||
} else { | ||
data = []; | ||
this.call_native("init", data, null); | ||
} | ||
} | ||
JPushPlugin.prototype.stopLogPageView = function(pageName) { | ||
if(this.isPlatformIOS()) { | ||
this.call_native("stopLogPageView", [pageName], null); | ||
JPushPlugin.prototype.getRegistrationID = function(callback) { | ||
try { | ||
var data = []; | ||
this.call_native("getRegistrationID", [data], callback); | ||
} catch(exception) { | ||
console.log(exception); | ||
} | ||
} | ||
JPushPlugin.prototype.beginLogPageView = function(pageName, duration) { | ||
if(this.isPlatformIOS()) { | ||
this.call_native("beginLogPageView", [pageName, duration], null); | ||
} | ||
JPushPlugin.prototype.stopPush = function() { | ||
data = []; | ||
this.call_native("stopPush", data, null); | ||
} | ||
JPushPlugin.prototype.setApplicationIconBadgeNumber = function(badge) { | ||
if(this.isPlatformIOS()) { | ||
this.call_native("setApplicationIconBadgeNumber", [badge], null); | ||
} | ||
JPushPlugin.prototype.resumePush = function() { | ||
data = []; | ||
this.call_native("resumePush", data, null); | ||
} | ||
JPushPlugin.prototype.getApplicationIconBadgeNumber = function(callback) { | ||
if(this.isPlatformIOS()) { | ||
this.call_native("getApplicationIconBadgeNumber", [], callback); | ||
} | ||
JPushPlugin.prototype.isPushStopped = function(callback) { | ||
data = []; | ||
this.call_native("isPushStopped", data, callback); | ||
} | ||
// iOS methods | ||
JPushPlugin.prototype.setTagsWithAlias = function(tags, alias) { | ||
@@ -97,11 +101,2 @@ try { | ||
JPushPlugin.prototype.getRegistrationID = function(callback) { | ||
try { | ||
var data = []; | ||
this.call_native("getRegistrationID", [data], callback); | ||
} catch(exception) { | ||
console.log(exception); | ||
} | ||
} | ||
JPushPlugin.prototype.setBadge = function(value) { | ||
@@ -190,2 +185,53 @@ if(this.isPlatformIOS()) { | ||
JPushPlugin.prototype.startLogPageView = function(pageName) { | ||
if(this.isPlatformIOS()) { | ||
this.call_native("startLogPageView", [pageName], null); | ||
} | ||
} | ||
JPushPlugin.prototype.stopLogPageView = function(pageName) { | ||
if(this.isPlatformIOS()) { | ||
this.call_native("stopLogPageView", [pageName], null); | ||
} | ||
} | ||
JPushPlugin.prototype.beginLogPageView = function(pageName, duration) { | ||
if(this.isPlatformIOS()) { | ||
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); | ||
} | ||
} | ||
// Android methods | ||
JPushPlugin.prototype.setDebugMode = function(mode) { | ||
if(device.platform == "Android") { | ||
this.call_native("setDebugMode", [mode], null); | ||
} | ||
} | ||
JPushPlugin.prototype.setBasicPushNotificationBuilder = function() { | ||
if(device.platform == "Android") { | ||
data = []; | ||
this.call_native("setBasicPushNotificationBuilder", data, null); | ||
} | ||
} | ||
JPushPlugin.prototype.setCustomPushNotificationBuilder = function() { | ||
if(device.platform == "Android") { | ||
data = []; | ||
this.call_native("setCustomPushNotificationBuilder", data, null); | ||
} | ||
} | ||
JPushPlugin.prototype.receiveMessageInAndroidCallback = function(data) { | ||
@@ -227,34 +273,2 @@ try { | ||
//android single | ||
JPushPlugin.prototype.setBasicPushNotificationBuilder = function() { | ||
if(device.platform == "Android") { | ||
data = []; | ||
this.call_native("setBasicPushNotificationBuilder", data, null); | ||
} | ||
} | ||
JPushPlugin.prototype.setCustomPushNotificationBuilder = function() { | ||
if(device.platform == "Android") { | ||
data = []; | ||
this.call_native("setCustomPushNotificationBuilder", data, null); | ||
} | ||
} | ||
JPushPlugin.prototype.stopPush = function() { | ||
data = []; | ||
this.call_native("stopPush", data, null); | ||
} | ||
JPushPlugin.prototype.resumePush = function() { | ||
data = []; | ||
this.call_native("resumePush", data, null); | ||
} | ||
JPushPlugin.prototype.setDebugMode = function(mode) { | ||
if(device.platform == "Android") { | ||
this.call_native("setDebugMode", [mode], null); | ||
} | ||
} | ||
JPushPlugin.prototype.clearAllNotification = function() { | ||
@@ -280,17 +294,2 @@ if(device.platform == "Android") { | ||
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) { | ||
@@ -303,5 +302,5 @@ if(device.platform == "Android") { | ||
JPushPlugin.prototype.addLocalNotification = function(builderId, content, title, | ||
notificaitonID, broadcastTime, extras) { | ||
notificationID, broadcastTime, extras) { | ||
if(device.platform == "Android") { | ||
data = [builderId, content, title, notificaitonID, broadcastTime, extras]; | ||
data = [builderId, content, title, notificationID, broadcastTime, extras]; | ||
this.call_native("addLocalNotification", data, null); | ||
@@ -333,3 +332,3 @@ } | ||
*在 Portal 上展示给开发者。 | ||
**/ | ||
*/ | ||
JPushPlugin.prototype.setStatisticsOpen = function(mode) { | ||
@@ -341,4 +340,16 @@ if(device.platform == "Android") { | ||
//iOS single | ||
/** | ||
* 用于在 Android 6.0 及以上系统,申请一些权限 | ||
* 具体可看:http://docs.jpush.io/client/android_api/#android-60 | ||
*/ | ||
JPushPlugin.prototype.requestPermission = function() { | ||
if(device.platform == "Android") { | ||
this.call_native("requestPermission", [], null); | ||
} | ||
} | ||
JPushPlugin.prototype.setSilenceTime = function() { | ||
} | ||
if(!window.plugins) { | ||
@@ -345,0 +356,0 @@ window.plugins = {}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 5 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 5 instances in 1 package
16949
240
12446673