From 9f921ea7b54ba01ae3334a2baa22e404d4df597c Mon Sep 17 00:00:00 2001 From: Pikachuode <57380422@QQ.com> Date: Tue, 15 Mar 2016 18:06:13 +0800 Subject: [PATCH 1/5] Update Common_detail_api.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 整理文档 --- document/Common_detail_api.md | 45 ++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/document/Common_detail_api.md b/document/Common_detail_api.md index c9a1329..a093570 100644 --- a/document/Common_detail_api.md +++ b/document/Common_detail_api.md @@ -87,14 +87,14 @@ JPush SDK 会恢复正常的默认行为。(因为保存在本地的状态数 + callback 回调函数,用来通知JPush的推送服务是否开启 ####代码示例 - window.plugins.jPushPlugin.resumePush(callback) - var onCallback = function(data) { - if(data>0){ + window.plugins.jPushPlugin.resumePush(callback) + var onCallback = function(data) { + if(data>0){ //开启 - }else{ + }else{ //关闭 - } } + } ##获取 RegistrationID API @@ -136,7 +136,7 @@ RegistrationID 定义 这几个 API 可以在 App 里任何地方调用。 -别名 alias +**别名 alias** 为安装了应用程序的用户,取个别名来标识。以后给该用户 Push 消息时,就可以用此别名来指定。 @@ -148,7 +148,7 @@ RegistrationID 定义 举例:在一个用户要登录的游戏中,可能设置别名为 userid。游戏运营时,发现该用户 3 天没有玩游戏了,则根据 userid 调用服务器端API发通知到客户端提醒用户。 -标签 tag +**标签 tag** 为安装了应用程序的用户,打上标签。其目的主要是方便开发者根据标签,来批量下发 Push 消息。 @@ -164,10 +164,6 @@ RegistrationID 定义 JPushPlugin.prototype.setTags = function(tags) JPushPlugin.prototype.setAlias = function(alias) -####使用平台 -android iOS - - #### 参数说明 * tags * 参数类型为数组 @@ -207,17 +203,18 @@ android iOS -|Code|描述|详细解释| -|-|-|-| -|6001| 无效的设置,tag/alias 不应参数都为 null|| -|6002| 设置超时| 建议重试| -|6003| alias| 字符串不合法 有效的别名、标签组成:字母(区分大小写)、数字、下划线、汉字。| -|6004| alias超长。最多 40个字节 中文 UTF-8 是 3 个字节| -|6005| 某一个 tag 字符串不合法| 有效的别名、标签组成:字母(区分大小写)、数字、下划线、汉字。| -|6006| 某一个 tag 超长。|一个 tag 最多 40个字节 中文 UTF-8 是 3 个字节| -|6007| tags 数量超出限制。最多 100个| 这是一台设备的限制。一个应用全局的标签数量无限制。| -|6008| tag/alias 超出总长度限制。|总长度最多 1K 字节| -|6011| 10s内设置tag或alias大于3次| 短时间内操作过于频繁| +|Code|描述 |详细解释 | +|----|:----------------------------------------|:--------| +|6001|无效的设置,tag/alias 不应参数都为 null | | +|6002|设置超时 |建议重试| +|6003|alias 字符串不合法 |有效的别名、标签组成:字母(区分大小写)、数字、下划线、汉字。| +|6004|alias超长。 |最多 40个字节 中文 UTF-8 是 3 个字节| +|6005|某一个 tag 字符串不合法 |有效的别名、标签组成:字母(区分大小写)、数字、下划线、汉字。| +|6006|某一个 tag 超长 |一个 tag 最多 40个字节 中文 UTF-8 是 3 个字节| +|6007|tags 数量超出限制。最多 100个 |这是一台设备的限制。一个应用全局的标签数量无限制。| +|6008|tag/alias 超出总长度限制 |总长度最多 1K 字节| +|6011|10s内设置tag或alias大于3次 |短时间内操作过于频繁| + ### 获取点击通知内容 @@ -264,6 +261,8 @@ ps:点击通知后传递的json object 保存在window.plugins.jPushPlugin.ope "sound":"default", "alert":"今天去哪儿" }, + "key1":"value1", + "key2":"value2", "_j_msgid":154604475 } @@ -312,6 +311,8 @@ ps:点击通知后传递的json object 保存在window.plugins.jPushPlugin.rec "sound":"default", "alert":"今天去哪儿" }, + "key1":"value1", + "key2":"value2", "_j_msgid":154604475 } From c2babc3a396a00ea1d02753ee26ca31b6551ac41 Mon Sep 17 00:00:00 2001 From: "E.B" <57380422@qq.com> Date: Mon, 21 Mar 2016 15:30:16 +0800 Subject: [PATCH 2/5] =?UTF-8?q?iOS-=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.AppDelegate+JPush.m中不再使用runtime --- src/ios/Plugins/AppDelegate+JPush.m | 30 ++++++++++------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/ios/Plugins/AppDelegate+JPush.m b/src/ios/Plugins/AppDelegate+JPush.m index b52c0ba..5bee122 100644 --- a/src/ios/Plugins/AppDelegate+JPush.m +++ b/src/ios/Plugins/AppDelegate+JPush.m @@ -9,30 +9,20 @@ #import "AppDelegate+JPush.h" #import "JPushPlugin.h" #import "JPUSHService.h" -#import @implementation AppDelegate (JPush) -+(void)load{ - Method origin; - Method swizzle; - origin=class_getInstanceMethod([self class],@selector(init)); - swizzle=class_getInstanceMethod([self class], @selector(init_plus)); - method_exchangeImplementations(origin, swizzle); -} +-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ + [JPushPlugin setLaunchOptions:launchOptions]; --(instancetype)init_plus{ - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(applicationDidLaunch:) - name:@"UIApplicationDidFinishLaunchingNotification" - object:nil]; - return [self init_plus]; -} - --(void)applicationDidLaunch:(NSNotification*)notification{ - if (notification) { - [JPushPlugin setLaunchOptions:notification.userInfo]; - } + //cordova didFinishLaunchingWithOptions + CGRect screenBounds = [[UIScreen mainScreen] bounds]; + self.window = [[UIWindow alloc] initWithFrame:screenBounds]; + self.viewController = [[CDVViewController alloc] init]; + self.window.rootViewController = self.viewController; + self.window.autoresizesSubviews = YES; + [self.window makeKeyAndVisible]; + return YES; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { From 7791f088b9ab73edd0daa0f519ea9dcd1974131c Mon Sep 17 00:00:00 2001 From: Pikachu <57380422@QQ.com> Date: Tue, 22 Mar 2016 11:09:43 +0800 Subject: [PATCH 3/5] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.更新iOS api --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f3e761..7fd8687 100644 --- a/README.md +++ b/README.md @@ -134,20 +134,29 @@ jpush-phonegap-plugin 支持 iOS,Android 的推送插件。 window.plugins.jPushPlugin.startLogPageView (pageName) window.plugins.jPushPlugin.stopLogPageView (pageName) window.plugins.jPushPlugin.beginLogPageView (pageName,duration) + + 设置Badge window.plugins.jPushPlugin.setBadge(value) window.plugins.jPushPlugin.resetBadge() window.plugins.jPushPlugin.setApplicationIconBadgeNumber(badge) + window.plugins.JPushPlugin.getApplicationIconBadgeNumber(callback) + + 本地通知 - + 后续版本加入 + window.plugins.JPushPlugin.addLocalNotificationForIOS(delayTime, content, badge, notificationID, extras) + window.plugins.JPushPlugin.deleteLocalNotificationWithIdentifierKeyInIOS() + window.plugins.JPushPlugin.clearAllLocalNotifications() + 日志等级设置 window.plugins.jPushPlugin.setDebugModeFromIos () window.plugins.jPushPlugin.setLogOFF() + window.plugins.JPushPlugin.setCrashLogON() ++ 地理位置上报 + + window.plugins.JPushPlugin.setLocation(latitude, longitude) [iOS API详细说明](document/iOS_detail_api.md) From b9b77840aba872f26e670a92e5c690b887fc9f6b Mon Sep 17 00:00:00 2001 From: Hevin <328066446@qq.com> Date: Tue, 22 Mar 2016 23:39:42 +0800 Subject: [PATCH 4/5] fix #80 --- src/android/JPushPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/JPushPlugin.java b/src/android/JPushPlugin.java index b1c2d7c..035226b 100644 --- a/src/android/JPushPlugin.java +++ b/src/android/JPushPlugin.java @@ -106,7 +106,7 @@ public class JPushPlugin extends CordovaPlugin { public void onPause(boolean multitasking) { Log.i(TAG, "---------------- onPause"); shouldCacheMsg = true; - if (isStatisticsOpened) { + if (isStatisticsOpened && multitasking) { JPushInterface.onPause(cordovaActivity); } } @@ -116,7 +116,7 @@ public class JPushPlugin extends CordovaPlugin { Log.i(TAG, "---------------- onResume" + "-" + JPushPlugin.openNotificationAlert + "-" + JPushPlugin.notificationAlert); - if (isStatisticsOpened) { + if (isStatisticsOpened && multitasking) { JPushInterface.onResume(cordovaActivity); } if (JPushPlugin.openNotificationAlert != null) { From e117f77a38343fbc8ce73d9e66f0a55f53198cce Mon Sep 17 00:00:00 2001 From: Hevin <328066446@qq.com> Date: Tue, 29 Mar 2016 18:02:26 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=88=86=E6=9E=90=E5=8A=9F=E8=83=BD=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/index.html | 1 - src/android/JPushPlugin.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/example/index.html b/example/index.html index 6d51792..6791637 100644 --- a/example/index.html +++ b/example/index.html @@ -95,7 +95,6 @@ }; var initiateUI = function () { - try { window.plugins.jPushPlugin.init(); getRegistrationID(); diff --git a/src/android/JPushPlugin.java b/src/android/JPushPlugin.java index 035226b..bfce837 100644 --- a/src/android/JPushPlugin.java +++ b/src/android/JPushPlugin.java @@ -68,7 +68,7 @@ public class JPushPlugin extends CordovaPlugin { private static String TAG = "JPushPlugin"; private static boolean shouldCacheMsg = false; - private static boolean isStatisticsOpened = true; // 是否开启统计分析功能 + private static boolean isStatisticsOpened = false; // 是否开启统计分析功能 public static String notificationAlert; public static Map notificationExtras = new HashMap();