diff --git a/README.md b/README.md index 81cd958..062b2b9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin) [![QQ Group](https://img.shields.io/badge/QQ%20Group-413602425-red.svg)]() -[![release](https://img.shields.io/badge/release-2.2.0-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases) +[![release](https://img.shields.io/badge/release-2.2.1-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases) [![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin) [![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1) @@ -63,7 +63,8 @@ ## 常见问题 -若要使用 CLI 来编译项目,注意应使用 cordova compile 而不是 cordova build 命令,因为 cordova build 会清除对插件文件的修改。 +若要使用 CLI 来编译项目,注意应使用 cordova compile 而不是 cordova build 命令,因为如果修改了插件安装时默认写入到 AndroidManifest.xml +中的代码,cordova build 可能会导致对 AndroidManifest.xml 的修改。 Cordova CLI 的具体用法可参考 [Cordova CLI 官方文档](https://cordova.apache.org/docs/en/latest/reference/cordova-cli/index.html)。 ### 1. Android diff --git a/package.json b/package.json index 9f32cf2..4c3cb88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jpush-phonegap-plugin", - "version": "2.2.0", + "version": "2.2.1", "description": "JPush for cordova plugin", "cordova": { "id": "cn.jpush.phonegap.JPushPlugin", diff --git a/plugin.xml b/plugin.xml index 7b3772f..41da5ea 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.2.1"> JPush Plugin JPush for cordova plugin @@ -55,9 +55,6 @@ - - - @@ -139,7 +136,6 @@ - @@ -169,20 +165,21 @@ - + - - - - - - + + + + + + + diff --git a/scripts/android-install.js b/scripts/android-install.js deleted file mode 100644 index bdc97b2..0000000 --- a/scripts/android-install.js +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env node - -module.exports = function (context) { - var path = context.requireCordovaModule('path'), - fs = context.requireCordovaModule('fs'), - shell = context.requireCordovaModule('shelljs'), - projectRoot = context.opts.projectRoot, - ConfigParser = context.requireCordovaModule('cordova-common/src/configparser/ConfigParser'), - config = new ConfigParser(path.join(context.opts.projectRoot, "config.xml")), - packageName = config.android_packageName() || config.packageName(); - - if (!packageName) { - console.error("Package name could not be found!"); - return ; - } - - // android platform available? - if (context.opts.cordova.platforms.indexOf("android") === -1) { - console.info("Android platform has not been added."); - return ; - } - - var targetDir = path.join(projectRoot, "platforms", "android", "src", "cn", "jpush", "phonegap"); - targetFile = path.join(targetDir, "JPushPlugin.java"); - console.log(targetDir); - - if (['after_plugin_add', 'after_plugin_install', 'after_platform_add'].indexOf(context.hook) === -1) { - // remove it? - try { - fs.unlinkSync(targetFile); - } catch (err) {} - } else { - // create directory - shell.mkdir('-p', targetDir); - - // sync the content - fs.readFile(path.join(context.opts.plugin.dir, 'src', 'android', 'JPushPlugin.java'), - {encoding: 'utf-8'}, function (err, data) { - if (err) { - throw err; - } - data = data.replace(/^import __PACKAGE_NAME__.R;/m, 'import ' + packageName + '.R;'); - fs.writeFileSync(targetFile, data); - }); - } -}; diff --git a/src/android/JPushPlugin.java b/src/android/JPushPlugin.java index ee23659..727f799 100644 --- a/src/android/JPushPlugin.java +++ b/src/android/JPushPlugin.java @@ -5,8 +5,6 @@ import android.content.Context; import android.text.TextUtils; import android.util.Log; -import __PACKAGE_NAME__.R; - import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaPlugin; @@ -438,19 +436,23 @@ public class JPushPlugin extends CordovaPlugin { } } + /** + * 自定义推送通知栏样式,需要自己实现具体代码。 + * http://docs.jiguang.cn/client/android_tutorials/#_11 + */ void setCustomPushNotificationBuilder(JSONArray data, CallbackContext callbackContext) { - CustomPushNotificationBuilder builder = new CustomPushNotificationBuilder( - this.cordova.getActivity(), R.layout.test_notification_layout, - R.id.icon, R.id.title, R.id.text); - builder.developerArg0 = "Custom Builder 1"; - JPushInterface.setPushNotificationBuilder(2, builder); - JSONObject obj = new JSONObject(); - try { - obj.put("id", 2); - } catch (JSONException e) { - e.printStackTrace(); - } + // CustomPushNotificationBuilder builder = new CustomPushNotificationBuilder( + // this.cordova.getActivity(), R.layout.test_notification_layout, + // R.id.icon, R.id.title, R.id.text); + // builder.developerArg0 = "Custom Builder 1"; + // JPushInterface.setPushNotificationBuilder(2, builder); + // JSONObject obj = new JSONObject(); + // try { + // obj.put("id", 2); + // } catch (JSONException e) { + // e.printStackTrace(); + // } } void clearAllNotification(JSONArray data, CallbackContext callbackContext) { diff --git a/src/android/arm64-v8a/libjpush215.so b/src/android/arm64-v8a/libjpush217.so similarity index 99% rename from src/android/arm64-v8a/libjpush215.so rename to src/android/arm64-v8a/libjpush217.so index 0220705..de6d111 100644 Binary files a/src/android/arm64-v8a/libjpush215.so and b/src/android/arm64-v8a/libjpush217.so differ diff --git a/src/android/armeabi-v7a/libjpush215.so b/src/android/armeabi-v7a/libjpush217.so similarity index 99% rename from src/android/armeabi-v7a/libjpush215.so rename to src/android/armeabi-v7a/libjpush217.so index bed2a1b..d47565c 100644 Binary files a/src/android/armeabi-v7a/libjpush215.so and b/src/android/armeabi-v7a/libjpush217.so differ diff --git a/src/android/armeabi/libjpush215.so b/src/android/armeabi/libjpush217.so similarity index 99% rename from src/android/armeabi/libjpush215.so rename to src/android/armeabi/libjpush217.so index 9e76dc8..34d56e7 100644 Binary files a/src/android/armeabi/libjpush215.so and b/src/android/armeabi/libjpush217.so differ diff --git a/src/android/jpush-android-2.1.5.jar b/src/android/jpush-android-2.1.5.jar deleted file mode 100644 index 800ee7b..0000000 Binary files a/src/android/jpush-android-2.1.5.jar and /dev/null differ diff --git a/src/android/jpush-android-2.1.7.jar b/src/android/jpush-android-2.1.7.jar new file mode 100644 index 0000000..dc17b80 Binary files /dev/null and b/src/android/jpush-android-2.1.7.jar differ diff --git a/src/android/x86/libjpush215.so b/src/android/x86/libjpush217.so similarity index 99% rename from src/android/x86/libjpush215.so rename to src/android/x86/libjpush217.so index 8a27c21..339e055 100644 Binary files a/src/android/x86/libjpush215.so and b/src/android/x86/libjpush217.so differ diff --git a/src/android/x86_64/libjpush215.so b/src/android/x86_64/libjpush217.so similarity index 99% rename from src/android/x86_64/libjpush215.so rename to src/android/x86_64/libjpush217.so index f9f0e56..68768b4 100644 Binary files a/src/android/x86_64/libjpush215.so and b/src/android/x86_64/libjpush217.so differ