diff --git a/.gitignore b/.gitignore index bc5ffa0..87c2512 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Created by https://www.gitignore.io/api/macos,apachecordova - +.idea ### ApacheCordova ### # Apache Cordova generated files and directories bin/* diff --git a/example/index.html b/example/index.html index d459ded..a5682c6 100644 --- a/example/index.html +++ b/example/index.html @@ -1,6 +1,6 @@ - + JPush Phonegap Simple Demo @@ -18,15 +18,15 @@ initiateUI(); }; - + var getRegistrationID = function() { window.JPush.getRegistrationID(onGetRegistrationID); }; - + var onGetRegistrationID = function(data) { try { console.log("JPushPlugin:registrationID is " + data); - + if (data.length == 0) { var t1 = window.setTimeout(getRegistrationID, 1000); } @@ -36,7 +36,7 @@ console.log(exception); } }; - + var onTagsWithAlias = function(event) { try { console.log("onTagsWithAlias"); @@ -48,7 +48,7 @@ console.log(exception) } }; - + var onOpenNotification = function(event) { try { var alertContent; @@ -62,7 +62,7 @@ console.log("JPushPlugin:onOpenNotification" + exception); } }; - + var onReceiveNotification = function(event) { try { var alertContent; @@ -76,7 +76,7 @@ console.log(exception) } }; - + var onReceiveMessage = function(event) { try { var message; @@ -90,7 +90,7 @@ console.log("JPushPlugin:onReceiveMessage-->" + exception); } }; - + var initiateUI = function() { try { window.JPush.init(); @@ -110,7 +110,7 @@ var tag2 = $("#tagText2").val() var tag3 = $("#tagText3").val() var tags = [] - + if (tag1) { tags.push(tag1) } @@ -123,7 +123,7 @@ window.JPush.setTags({ sequence: 1, tags: tags }, function (result) { - $("#tagsResult").html(result.tags) + $("#tagsResult").html(JSON.stringify(result.tags)) }, function (error) { alert(error.code) }) @@ -135,7 +135,7 @@ $("#getAllTags").click(function (event) { window.JPush.getAllTags({ sequence: 2 }, function (result) { - $("#tagsResult").html(result.tags) + $("#tagsResult").html(JSON.stringify(result.tags)) }, function (error) { alert(error.code) }) @@ -179,14 +179,14 @@ }) }); }; - + document.addEventListener("deviceready", onDeviceReady, false); document.addEventListener("jpush.openNotification", onOpenNotification, false); document.addEventListener("jpush.receiveNotification", onReceiveNotification, false); document.addEventListener("jpush.receiveMessage", onReceiveMessage, false); - +
@@ -235,7 +235,7 @@
- +
diff --git a/package.json b/package.json index 164bb74..61d723b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jpush-phonegap-plugin", - "version": "3.6.4", + "version": "3.7.0", "description": "JPush for cordova plugin", "cordova": { "id": "jpush-phonegap-plugin", @@ -23,7 +23,7 @@ ], "devDependencies": { "cordova-plugin-device": "*", - "cordova-plugin-jcore": ">=1.2.8" + "cordova-plugin-jcore": ">=1.3.0" }, "author": "JiGuang", "license": "MIT", diff --git a/plugin.xml b/plugin.xml index 451ea4a..d824af0 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="3.7.0"> JPush JPush for cordova plugin @@ -82,8 +82,8 @@ + - @@ -91,21 +91,51 @@ - + + + - + + + + + + + + + + + + + + + + + + + + + - + + @@ -116,34 +146,39 @@ + android:authorities="应用的包名.DataProvider" + android:name="cn.jpush.android.service.DataProvider" + android:process=":pushcore" + android:exported="false" + /> - + - + + - + - - + @@ -154,76 +189,71 @@ + - - - - - - - - - - - - - - - - - - - - - + - + + - + - + + + + + + + + + + + + + + + + + + + android:name="cn.jiguang.cordova.push.JPushReceiver" + android:enabled="true" + android:exported="false"> - + + + + + - - - - + - + + - - - + + target="res/values/jpush_style.xml" /> + + + diff --git a/src/android/JPushEventReceiver.java b/src/android/JPushEventReceiver.java index 7fe07db..17184d9 100644 --- a/src/android/JPushEventReceiver.java +++ b/src/android/JPushEventReceiver.java @@ -1,6 +1,7 @@ package cn.jiguang.cordova.push; import android.content.Context; +import android.content.Intent; import android.text.TextUtils; import android.util.Log; @@ -9,9 +10,13 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import java.util.Map; import java.util.Set; +import cn.jpush.android.api.CustomMessage; +import cn.jpush.android.api.JPushInterface; import cn.jpush.android.api.JPushMessage; +import cn.jpush.android.api.NotificationMessage; import cn.jpush.android.service.JPushMessageReceiver; public class JPushEventReceiver extends JPushMessageReceiver { @@ -21,7 +26,7 @@ public class JPushEventReceiver extends JPushMessageReceiver { @Override public void onTagOperatorResult(Context context, JPushMessage jPushMessage) { super.onTagOperatorResult(context, jPushMessage); - + //Log.e(TAG,"onTagOperatorResult:"+jPushMessage); JSONObject resultJson = new JSONObject(); int sequence = jPushMessage.getSequence(); @@ -72,6 +77,7 @@ public class JPushEventReceiver extends JPushMessageReceiver { public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) { super.onCheckTagOperatorResult(context, jPushMessage); + //Log.e(TAG,"onCheckTagOperatorResult:"+jPushMessage); JSONObject resultJson = new JSONObject(); int sequence = jPushMessage.getSequence(); @@ -113,6 +119,7 @@ public class JPushEventReceiver extends JPushMessageReceiver { public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) { super.onAliasOperatorResult(context, jPushMessage); + //Log.e(TAG,"onAliasOperatorResult:"+jPushMessage); JSONObject resultJson = new JSONObject(); int sequence = jPushMessage.getSequence(); @@ -152,4 +159,44 @@ public class JPushEventReceiver extends JPushMessageReceiver { JPushPlugin.eventCallbackMap.remove(sequence); } + + @Override + public void onRegister(Context context, String regId) { + //Log.e(TAG,"onRegister:"+regId); + JPushPlugin.transmitReceiveRegistrationId(regId); + } + + @Override + public void onMessage(Context context, CustomMessage customMessage) { + super.onMessage(context,customMessage); + //Log.e(TAG,"onMessage:"+customMessage); +// String msg = customMessage.message;//intent.getStringExtra(JPushInterface.EXTRA_MESSAGE); +// Map extras = getNotificationExtras(intent); +// JPushPlugin.transmitMessageReceive(msg, extras); + } + + @Override + public void onNotifyMessageArrived(Context context, NotificationMessage notificationMessage) { + super.onNotifyMessageArrived(context, notificationMessage); + + //Log.e(TAG,"onNotifyMessageArrived:"+notificationMessage); + } + + @Override + public void onNotifyMessageOpened(Context context, NotificationMessage notificationMessage) { + super.onNotifyMessageOpened(context, notificationMessage); + //Log.e(TAG,"onNotifyMessageOpened:"+notificationMessage); + } + + @Override + public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) { + super.onMobileNumberOperatorResult(context, jPushMessage); + //Log.e(TAG,"onMobileNumberOperatorResult:"+jPushMessage); + } + + @Override + public void onMultiActionClicked(Context context, Intent intent) { + super.onMultiActionClicked(context, intent); + //Log.e(TAG,"onMultiActionClicked:"+intent); + } } diff --git a/src/android/PushService.java b/src/android/PushService.java new file mode 100644 index 0000000..2b0974e --- /dev/null +++ b/src/android/PushService.java @@ -0,0 +1,6 @@ +package cn.jiguang.cordova.push; + +import cn.jpush.android.service.JCommonService; + +public class PushService extends JCommonService { +} diff --git a/src/android/libs/jpush-android-3.2.0.jar b/src/android/libs/jpush-android-3.2.0.jar deleted file mode 100755 index 76e90c4..0000000 Binary files a/src/android/libs/jpush-android-3.2.0.jar and /dev/null differ diff --git a/src/android/libs/jpush-android-3.3.4.jar b/src/android/libs/jpush-android-3.3.4.jar new file mode 100755 index 0000000..fef22f8 Binary files /dev/null and b/src/android/libs/jpush-android-3.3.4.jar differ diff --git a/src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png b/src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png old mode 100644 new mode 100755 diff --git a/src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png b/src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png old mode 100644 new mode 100755 diff --git a/src/android/res/layout/push_notification.xml b/src/android/res/layout/push_notification.xml new file mode 100755 index 0000000..299ea09 --- /dev/null +++ b/src/android/res/layout/push_notification.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/android/res/layout/test_notification_layout.xml b/src/android/res/layout/test_notification_layout.xml deleted file mode 100644 index 556c45c..0000000 --- a/src/android/res/layout/test_notification_layout.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/android/res/values-zh/jpush_string.xml b/src/android/res/values-zh/jpush_string.xml new file mode 100755 index 0000000..069b6f4 --- /dev/null +++ b/src/android/res/values-zh/jpush_string.xml @@ -0,0 +1,7 @@ + + + 不重要 + 不重要 + 普通 + 重要 + \ No newline at end of file diff --git a/src/android/res/values/jpush_string.xml b/src/android/res/values/jpush_string.xml new file mode 100755 index 0000000..70a4ea7 --- /dev/null +++ b/src/android/res/values/jpush_string.xml @@ -0,0 +1,8 @@ + + + LOW + LOW + NORMAL + HIGH + + \ No newline at end of file