PhoneGap jpush android 一直获取不到registerId

registrationid
android
标签: #<Tag:0x00007fb845ec3c68> #<Tag:0x00007fb845ec3ab0>

(Rush) #1

接入极光推送的cordova插件,发现在android手机上一直无法获取RegisterId。客户端也没有android的用户,以为是初始化失败,但是过了一段时间发现客户端上注册好了。
截了一部分日志,望大神看看:

08-07 20:47:15.770 23161-23161/com.kohler.test D/JIGUANG-JCore: [AndroidUtil] action:checkValidManifest
08-07 20:47:15.770 23161-23161/com.kohler.test D/JIGUANG-JCore: [JCoreServiceUtils] set Push/Alarm Receiver enabled
08-07 20:47:15.830 23161-23161/com.kohler.test D/JIGUANG-JCore: [JCoreGlobal] action:init - sdkVersion:1.1.6, buildId:152
08-07 20:47:15.830 23161-23161/com.kohler.test D/dalvikvm: Trying to load lib /data/app-lib/com.kohler.test-1/libjcore116.so 0x421599b8
08-07 20:47:15.830 23161-23161/com.kohler.test D/dalvikvm: Added shared lib /data/app-lib/com.kohler.test-1/libjcore116.so 0x421599b8
08-07 20:47:15.830 23161-23161/com.kohler.test D/JIGUANG-JCore: [JCoreGlobal] metadata: appKey - 8b712998f1edd9d67eac611d
08-07 20:47:15.830 23161-23161/com.kohler.test D/JIGUANG-JCore: [JCoreGlobal] metadata: channel - developer-default

#2

这部分日志,没什么信息,请提供完整的客户端日志,从init开始到集成成功

并说明使用的插件的版本号,以及说明你是ionic项目还是cordova项目,是ionic几


(Rush) #3

是ionic项目,ionic 1.7, 日志就那么多了 ,没什么有价值的日志,后面就没有极光的日志了。


#4

那不应该,你开启debug了没有,开启了debug,集成注册的过程日志里面会完整打印,最终会打印成功的信息


(Rush) #5

开启了debug模式,设置为true了。确实没有日志


#6

phonegap插件的版本号是多少?
你更新到最新,并且去监听一下注册成功的事件
将debug放在init之前
并检查有没有做有关日志屏蔽相关的事情。


(Rush) #7

设置了日志模式打开在init之前,确实没几个日志。
08-08 10:42:05.499 14413-15572/com.kohlerIOT.test D/JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.0.6, buildId:367
08-08 10:42:05.509 14413-15572/com.kohlerIOT.test I/JIGUANG-JPush: [PluginPlatformsInterface] whichPlatform - 0
就这么些日志。
cordova 插件是3.1.7版本的,是在github上下载的最新的呢


(Hevin) #8

插件最新版本为 v3.2.3,先尝试更新插件到最新版本。


(Rush) #9

更新到了最新版本,

 D/JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.0.6, buildId:367
                                                                 
                                                                 [ 08-08 12:22:27.418  7228: 7228 I/         ]
                                                                 power log dlsym ok
08-08 12:22:27.419 6915-7073/com.kohlerIOT.test I/JIGUANG-JPush: [PluginPlatformsInterface] whichPlatform - 0

日志到这里就没有极光的相关日志了


#10

你确定你setDebugMode(true)了吗?
监听注册事件 能取到registrationID吗


(Rush) #11

我设置了setDebugMode(true),自己在plugin里面加了日志打印了出来,所有关于极光的日志给你看下包括我自己打印的:

D/JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.0.6, buildId:367
I/JIGUANG-JPush: [PluginPlatformsInterface] whichPlatform - 0
I/JPushPlugin: JPush setDebugMode.true
I/JPushPlugin: JPush getRegistrationID.120c83f76010d578e38

拿到RegistrationID,收不到推送消息


(Hevin) #12

ionic 1.7 项目,监听事件要写在 index.js 的 onDeviceReady 方法中,你可以监听 jpush.receiveRegistrationId 方法:

window.plugins.jPushPlugin.init();
window.plugins.jPushPlugin.setDebugMode(true);
document.addEventListener('jpush.receiveRegistrationId', (event) => {  // 只在第一次注册成功时触发,之后可调用 getRegistrationId 方法。
  var rId = event.registrationId;
})

#13

拿到了但收不到消息的问题,给我提供你推送的消息的msgid


(Rush) #14
08-08 13:26:59.818 22135-22135/com.kohlerIOT.test I/chromium: [INFO:CONSOLE(4791)] "JPushPlugin:Device ready!", source: file:///android_asset/www/build/app.bundle.js (4791)
08-08 13:26:59.828 22135-22974/com.kohlerIOT.test I/JPushPlugin: JPush initialize.
08-08 13:26:59.828 22135-22974/com.kohlerIOT.test D/JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.0.6, buildId:367
08-08 13:26:59.878 22135-22974/com.kohlerIOT.test I/dalvikvm: Could not find method com.xiaomi.mipush.sdk.MiPushClient.shouldUseMIUIPush, referenced from method cn.jpush.android.c.i.c
08-08 13:26:59.878 22135-22974/com.kohlerIOT.test W/dalvikvm: VFY: unable to resolve static method 18313: Lcom/xiaomi/mipush/sdk/MiPushClient;.shouldUseMIUIPush (Landroid/content/Context;)Z
08-08 13:26:59.878 22135-22974/com.kohlerIOT.test D/dalvikvm: VFY: replacing opcode 0x71 at 0x000e
08-08 13:26:59.878 22135-22974/com.kohlerIOT.test W/dalvikvm: VFY: unable to resolve static field 6563 (HuaweiPushApi) in Lcom/huawei/hms/support/api/push/HuaweiPush;
08-08 13:26:59.878 22135-22974/com.kohlerIOT.test D/dalvikvm: VFY: replacing opcode 0x62 at 0x001a
08-08 13:26:59.878 22135-22974/com.kohlerIOT.test I/JIGUANG-JPush: [PluginPlatformsInterface] whichPlatform - 0
08-08 13:26:59.888 22135-23000/com.kohlerIOT.test D/JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.0.6, buildId:367
08-08 13:26:59.888 22135-23000/com.kohlerIOT.test I/JIGUANG-JPush: [PluginPlatformsInterface] whichPlatform - 0
08-08 13:26:59.888 22135-23000/com.kohlerIOT.test I/JPushPlugin: JPush setDebugMode.true
08-08 13:26:59.908 22135-22974/com.kohlerIOT.test I/App: WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!
08-08 13:26:59.928 22135-22974/com.kohlerIOT.test V/StatusBar: Executing action: styleDefault
08-08 13:26:59.948 22135-22975/com.kohlerIOT.test W/AssetFilesystem: Asset manifest not found. Recursive copies and directory listing will be slow.
08-08 13:27:00.058 22135-22975/com.kohlerIOT.test W/ContextImpl: Failed to ensure directory: /storage/sdcard1/Android/data/com.kohlerIOT.test/files
08-08 13:27:00.058 22135-22975/com.kohlerIOT.test W/ContextImpl: Failed to ensure directory: /storage/sdcard1/Android/data/com.kohlerIOT.test/files
08-08 13:27:00.068 22135-22975/com.kohlerIOT.test W/ContextImpl: Failed to ensure directory: /storage/sdcard1/Android/data/com.kohlerIOT.test/cache
08-08 13:27:00.078 22135-22975/com.kohlerIOT.test W/ContextImpl: Failed to ensure directory: /storage/sdcard1/Android/data/com.kohlerIOT.test/files
08-08 13:27:00.088 22135-22975/com.kohlerIOT.test W/ContextImpl: Failed to ensure directory: /storage/sdcard1/Android/data/com.kohlerIOT.test/files
08-08 13:27:00.088 22135-22975/com.kohlerIOT.test W/ContextImpl: Failed to ensure directory: /storage/sdcard1/Android/data/com.kohlerIOT.test/cache
08-08 13:27:00.888 22135-23000/com.kohlerIOT.test I/JPushPlugin: JPush getRegistrationID.120c83f76010d578e38
08-08 13:27:00.898 22135-22135/com.kohlerIOT.test I/chromium: [INFO:CONSOLE(4767)] "JPushPlugin:registrationID is 120c83f76010d578e38", source: file:///android_asset/www/build/app.bundle.js (4767)
08-08 13:28:09.488 22135-22135/com.kohlerIOT.test E/chromium: [ERROR:xwalk_autofill_client.cc(121)] Not implemented reached in virtual void xwalk::XWalkAutofillClient::OnFirstUserGestureObserved()

是这样写的呢 拿到了registerId 在平台上推送 一直收不到
手机有联网的


(Rush) #15

2251800142978154 这个是messageId
手机没有收到推送的内容


#16

该消息查询结果如下:
你们的App与极光服务器断开了连接导致下发失败,你看看
getConnectionState
获取长连接状态应是断开的。

等待你们再次上线才能下发,你试试切换网络等措施


(Rush) #17

为什么会断开。。我都是在前台显示呢。 如果我自己的应用也开启了一些service会有影响吗


#18

1、请检查你有没有调用stoppush,如果调用了,请调用resumepush恢复


2、请切换网络测试一下