mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-21 13:02:53 +08:00
Merge branch 'dev'
This commit is contained in:
commit
ae54960da4
@ -1,7 +1,7 @@
|
||||
# JPush PhoneGap / Cordova Plugin
|
||||
|
||||
[](https://travis-ci.org/jpush/jpush-phonegap-plugin)
|
||||
[](https://github.com/jpush/jpush-phonegap-plugin/releases)
|
||||
[](https://github.com/jpush/jpush-phonegap-plugin/releases)
|
||||
[](https://github.com/jpush/jpush-phonegap-plugin)
|
||||
[](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
- [注册成功事件](#注册成功事件)
|
||||
- [获取集成日志(同时适用于 iOS)](#获取集成日志同时适用于-ios)
|
||||
- [统计分析](#统计分析)
|
||||
- [清除通知](#清除通知)
|
||||
- [设置允许推送时间](#设置允许推送时间)
|
||||
- [设置通知静默时间](#设置通知静默时间)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jpush-phonegap-plugin",
|
||||
"version": "3.2.4",
|
||||
"version": "3.2.5",
|
||||
"description": "JPush for cordova plugin",
|
||||
"cordova": {
|
||||
"id": "jpush-phonegap-plugin",
|
||||
|
20
plugin.xml
20
plugin.xml
@ -2,7 +2,7 @@
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="jpush-phonegap-plugin"
|
||||
version="3.2.4">
|
||||
version="3.2.5">
|
||||
|
||||
<name>JPush</name>
|
||||
<description>JPush for cordova plugin</description>
|
||||
@ -72,20 +72,22 @@
|
||||
|
||||
<config-file target="AndroidManifest.xml" parent="/manifest">
|
||||
<!-- Required 一些系统要求的权限,如访问网络等-->
|
||||
<permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<uses-permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE" />
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"
|
||||
android:protectionLevel="signature" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
</config-file>
|
||||
|
||||
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
||||
@ -187,12 +189,18 @@
|
||||
android:name="cn.jpush.android.service.AlarmReceiver"
|
||||
android:exported="false" />
|
||||
|
||||
<!-- since 3.0.9 Required SDK 核心功能-->
|
||||
<provider
|
||||
android:authorities="$PACKAGE_NAME.DataProvider"
|
||||
android:name="cn.jpush.android.service.DataProvider"
|
||||
android:exported="true" />
|
||||
|
||||
<!-- Required. Enable it you can get statistics data with channel -->
|
||||
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default" />
|
||||
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
|
||||
</config-file>
|
||||
|
||||
<source-file src="src/android/libs/jpush-android-3.0.8.jar" target-dir="libs" />
|
||||
<source-file src="src/android/libs/jpush-android-3.0.9.jar" target-dir="libs" />
|
||||
|
||||
<source-file src="src/android/MyReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||
|
@ -39,15 +39,12 @@ import cn.jpush.android.service.JPushMessageReceiver;
|
||||
|
||||
public class JPushPlugin extends CordovaPlugin {
|
||||
|
||||
private ExecutorService threadPool = Executors.newFixedThreadPool(1);
|
||||
|
||||
private static final String TAG = JPushPlugin.class.getSimpleName();
|
||||
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private static JPushPlugin instance;
|
||||
private static Activity cordovaActivity;
|
||||
private static String TAG = "JPushPlugin";
|
||||
|
||||
private static boolean isStatisticsOpened = false; // 是否开启统计分析功能
|
||||
|
||||
static String notificationTitle;
|
||||
static String notificationAlert;
|
||||
@ -85,16 +82,7 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause(boolean multitasking) {
|
||||
if (isStatisticsOpened && multitasking) {
|
||||
JPushInterface.onPause(this.cordova.getActivity());
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume(boolean multitasking) {
|
||||
if (isStatisticsOpened && multitasking) {
|
||||
JPushInterface.onResume(this.cordova.getActivity());
|
||||
}
|
||||
if (openNotificationAlert != null) {
|
||||
notificationAlert = null;
|
||||
transmitNotificationOpen(openNotificationTitle, openNotificationAlert,
|
||||
@ -252,7 +240,7 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
@Override
|
||||
public boolean execute(final String action, final JSONArray data,
|
||||
final CallbackContext callbackContext) throws JSONException {
|
||||
threadPool.execute(new Runnable() {
|
||||
cordova.getThreadPool().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@ -644,17 +632,6 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
JPushInterface.clearLocalNotifications(this.cordova.getActivity());
|
||||
}
|
||||
|
||||
/**
|
||||
* 决定是否启用统计分析功能。
|
||||
*/
|
||||
void setStatisticsOpen(JSONArray data, CallbackContext callbackContext) {
|
||||
try {
|
||||
isStatisticsOpened = data.getBoolean(0);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置通知静默时间
|
||||
* http://docs.jpush.io/client/android_api/#api_5
|
||||
|
Binary file not shown.
BIN
src/android/libs/jpush-android-3.0.9.jar
Executable file
BIN
src/android/libs/jpush-android-3.0.9.jar
Executable file
Binary file not shown.
@ -311,21 +311,18 @@ JPushPlugin.prototype.receiveRegistrationIdInAndroidCallback = function (data) {
|
||||
|
||||
JPushPlugin.prototype.receiveMessageInAndroidCallback = function (data) {
|
||||
data = JSON.stringify(data)
|
||||
console.log('JPushPlugin:receiveMessageInAndroidCallback: ' + data)
|
||||
this.receiveMessage = JSON.parse(data)
|
||||
cordova.fireDocumentEvent('jpush.receiveMessage', this.receiveMessage)
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.openNotificationInAndroidCallback = function (data) {
|
||||
data = JSON.stringify(data)
|
||||
console.log('JPushPlugin:openNotificationInAndroidCallback: ' + data)
|
||||
this.openNotification = JSON.parse(data)
|
||||
cordova.fireDocumentEvent('jpush.openNotification', this.openNotification)
|
||||
}
|
||||
|
||||
JPushPlugin.prototype.receiveNotificationInAndroidCallback = function (data) {
|
||||
data = JSON.stringify(data)
|
||||
console.log('JPushPlugin:receiveNotificationInAndroidCallback: ' + data)
|
||||
this.receiveNotification = JSON.parse(data)
|
||||
cordova.fireDocumentEvent('jpush.receiveNotification', this.receiveNotification)
|
||||
}
|
||||
@ -368,16 +365,6 @@ JPushPlugin.prototype.reportNotificationOpened = function (msgID) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*是否开启统计分析功能,用于“用户使用时长”,“活跃用户”,“用户打开次数”的统计,并上报到服务器上,
|
||||
*在 Portal 上展示给开发者。
|
||||
*/
|
||||
JPushPlugin.prototype.setStatisticsOpen = function (mode) {
|
||||
if (device.platform === 'Android') {
|
||||
this.callNative('setStatisticsOpen', [mode], null)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于在 Android 6.0 及以上系统,申请一些权限
|
||||
* 具体可看:http://docs.jpush.io/client/android_api/#android-60
|
||||
|
Loading…
Reference in New Issue
Block a user