无法订阅,服务器上的通知令牌未更新

时间:2015-03-31 00:58:36

标签: android push-notification ibm-mobilefirst mobilefirst-server

在我的应用中,我看到以下消息:

  

无法订阅,服务器上的通知令牌未更新

当我尝试在本地服务器中订阅基于标记的通知时。我不知道如何刷新本地服务器中的令牌。我使用的是MobileFirst v7.0

  

03-31 16:58:25.308 18445-18445 / com.test.eluniversal.tagsuniversal   D / OpenGLRenderer:启用调试模式0 03-31 16:58:25.318   18445-18467 / com.test.eluniversal.tagsuniversal D / WLClient:   WLClient $ ActivityListener.onActivitySaveInstanceState in   WLClient.java:1428 :: on活动保存实例状态   com.test.eluniversal.tagsuniversal.ActivityPrincipal

     

03-31 16:58:25.318 18445-18467 / com.test.eluniversal.tagsuniversal   D / WLClient:WLClient $ ActivityListener.onActivityStopped in   WLClient.java:1440 :: on活动已停止   com.test.eluniversal.tagsuniversal.ActivityPrincipal

     

03-31 16:58:27.870 18445-18467 / com.test.eluniversal.tagsuniversal   D / WLClient:WLClient $ ActivityListener.onActivityStarted in   WLClient.java:1434 :: on活动开始了   com.test.eluniversal.tagsuniversal.ActivityPrincipal

     

03-31 16:58:27.900 18445-18467 / com.test.eluniversal.tagsuniversal   D / WLClient:WLClient $ ActivityListener.onActivityResumed in   WLClient.java:1423 :: on活动已恢复   com.test.eluniversal.tagsuniversal.ActivityPrincipal。活动计数   = 1

     

03-31 16:58:29.872 18445-18467 / com.test.eluniversal.tagsuniversal D / wl.request:WLRequestSender.java中的WLRequestSender.run:40 ::   发送请求    http://172.16.134.52:10080/TagsUniversal/apps/services/api/TagsUniversalApp/Androidnative/init

     

03-31 16:58:30.043 18445-18467 / com.test.eluniversal.tagsuniversal   D / com.worklight.wlclient.api.WLPush:WLPush.updateToken in   WLPush.java:521 ::在GCM服务器上注册。

     

03-31 16:58:30.043   18445-18467 / com.test.eluniversal.tagsuniversal D / GCMHelperUtil:   GCMHelperUtil.java中的GCMHelperUtil.register:34 ::注册   带senderId的GCM服务器:427411077190

     

03-31 16:58:30.053 18445-18467 / com.test.eluniversal.tagsuniversal   d / com.worklight.wlclient.api.WLPush:   WLPush.java中的WLPush.clearSubscribedEventSources:596 ::清除   通知订阅。

     

03-31 16:58:30.053 18445-18467 / com.test.eluniversal.tagsuniversal   D / com.worklight.wlclient.api.WLPush:WLPush.clearSubscribedTag in   WLPush.java:607 ::清除标签通知订阅。

     

03-31 16:58:30.053 18445-18467 / com.test.eluniversal.tagsuniversal   D / com.worklight.wlclient.api.WLPush:WLPush.updateSubscribedTag in   WLPush.java:635 ::更新标签通知订阅。

     

03-31 16:58:30.063 18445-18546 / com.test.eluniversal.tagsuniversal   D /已连接:已成功连接

     

03-31 16:58:33.065 18445-18467 / com.test.eluniversal.tagsuniversal D / WLClient:   WLClient.java中的WLClient.createInstance:213:WLClient已经存在   已创建。

     

03-31 16:58:33.075 18445-18445 / com.test.eluniversal.tagsuniversal   W / GooglePlayServicesUtil:Google Play服务已过期。需要   7095000但发现4324038

     

03-31 16:58:33.075 18445-18467 / com.test.eluniversal.tagsuniversal D / GCMClientFactory:   GCMClientFactory.useGooglePlayServices in GCMClientFactory.java:38 ::   无法使用Google Play服务,因为返回代码为2

     

03-31 16:58:33.075 18445-18467 / com.test.eluniversal.tagsuniversal   D / GCMClientFactory:GCMClientFactory.getInstance in   GCMClientFactory.java:28 ::使用GCMHelperClient

     

03-31 16:58:33.085 18445-18467 / com.test.eluniversal.tagsuniversal W / GCMHelperClient:   GCMHelperClient.java:95中的GCMHelperClient.unregisterReceivers ::   取消注册:Receiver未注册:null

     

03-31 16:58:33.085 18445-18467 / com.test.eluniversal.tagsuniversal W / GCMHelperClient:   GCMHelperClient.java:101中的GCMHelperClient.unregisterReceivers ::   取消注册:Receiver未注册:null

     

03-31 16:58:33.085 18445-18467 / com.test.eluniversal.tagsuniversal   W / com.worklight.wlclient.api.WLPush:WLPush.unregisterReceivers in   WLPush.java:792 :: unregisterReceivers:Receiver未注册:   com.worklight.wlclient.api.WLPush$3@42e89a88

     

03-31 16:58:33.096 18445-18467 / com.test.eluniversal.tagsuniversal   E / com.worklight.wlclient.api.WLPush:WLPush.isAbleToSubscribe in   WLPush.java:414 ::无法订阅,通知令牌未更新   在服务器上

     

03-31 16:58:33.096 18445-18467 / com.test.eluniversal.tagsuniversal D / wl.request:   WLRequestSender.java中的WLRequestSender.run:40 ::发送请求   http://172.16.134.52:10080/TagsUniversal/apps/services/api/TagsUniversalApp/Androidnative/init

     

03-31 16:58:40.383 18445-18467 / com.test.eluniversal.tagsuniversal   D / com.worklight.wlclient.api.WLPush:WLPush.updateToken in   WLPush.java:521 ::在GCM服务器上注册。

     

03-31 16:58:40.393 18445-18467 / com.test.eluniversal.tagsuniversal D / GCMHelperUtil:   GCMHelperUtil.java中的GCMHelperUtil.register:34 ::注册   带senderId的GCM服务器:427411077190

     

03-31 16:58:40.423 18445-18467 / com.test.eluniversal.tagsuniversal   d / com.worklight.wlclient.api.WLPush:   WLPush.java中的WLPush.clearSubscribedEventSources:596 ::清除   通知订阅。

     

03-31 16:58:40.423 18445-18467 / com.test.eluniversal.tagsuniversal   D / com.worklight.wlclient.api.WLPush:WLPush.clearSubscribedTag in   WLPush.java:607 ::清除标签通知订阅。

     

03-31 16:58:40.423 18445-18467 / com.test.eluniversal.tagsuniversal   D / com.worklight.wlclient.api.WLPush:WLPush.updateSubscribedTag in   WLPush.java:635 ::更新标签通知订阅。

     

03-31 16:58:40.423 18445-18572 / com.test.eluniversal.tagsuniversal   D /已订阅:已成功订阅推送通知

2 个答案:

答案 0 :(得分:0)

从您收录的logcat看,已安装的Google Play服务版本已过期。

03-31 16:58:33.075 18445-18467/com.test.eluniversal.tagsuniversal D/GCMClientFactory﹕ GCMClientFactory.useGooglePlayServices in GCMClientFactory.java:38 :: Failed to use Google Play Services becuase the return code is 2

返回代码2是常量ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED

的值

http://developer.android.com/reference/com/google/android/gms/common/ConnectionResult.html#SERVICE_VERSION_UPDATE_REQUIRED

从Android SDK Manager更新Google Play services并重建您的应用。

更新:

根据您的反馈,您运行应用的设备上的 Google Play服务 apk已经过时了。

更新了您的主活动 onResume代码,如下所示:

@Override
protected void onResume() {
    super.onResume();

    int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

    if(code == ConnectionResult.SERVICE_MISSING || code == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED || code == ConnectionResult.SERVICE_DISABLED) {
        Dialog dialog = GooglePlayServicesUtil.getErrorDialog(code, this, 1);
        dialog.show();
    }

}

这是在Android的文档https://developer.android.com/google/play-services/setup.html#ensure

中提出的

答案 1 :(得分:-1)

发送到android studio logcat:

和其他人在同一个app中记录intent subscriber其他标记:

    03-31 16:58:25.308  18445-18445/com.test.eluniversal.tagsuniversal D/OpenGLRenderer﹕ Enabling debug mode 0
03-31 16:58:25.318  18445-18467/com.test.eluniversal.tagsuniversal D/WLClient﹕ WLClient$ActivityListener.onActivitySaveInstanceState in WLClient.java:1428 :: on activity save instance state com.test.eluniversal.tagsuniversal.ActivityPrincipal
03-31 16:58:25.318  18445-18467/com.test.eluniversal.tagsuniversal D/WLClient﹕ WLClient$ActivityListener.onActivityStopped in WLClient.java:1440 :: on activity stopped com.test.eluniversal.tagsuniversal.ActivityPrincipal
03-31 16:58:27.870  18445-18467/com.test.eluniversal.tagsuniversal D/WLClient﹕ WLClient$ActivityListener.onActivityStarted in WLClient.java:1434 :: on activity started com.test.eluniversal.tagsuniversal.ActivityPrincipal
03-31 16:58:27.900  18445-18467/com.test.eluniversal.tagsuniversal D/WLClient﹕ WLClient$ActivityListener.onActivityResumed in WLClient.java:1423 :: on activity resumed com.test.eluniversal.tagsuniversal.ActivityPrincipal . activity count = 1
03-31 16:58:29.872  18445-18467/com.test.eluniversal.tagsuniversal D/wl.request﹕ WLRequestSender.run in WLRequestSender.java:40 :: Sending request http://172.16.134.52:10080/TagsUniversal/apps/services/api/TagsUniversalApp/Androidnative/init
03-31 16:58:30.043  18445-18467/com.test.eluniversal.tagsuniversal D/com.worklight.wlclient.api.WLPush﹕ WLPush.updateToken in WLPush.java:521 :: Registering at the GCM server.
03-31 16:58:30.043  18445-18467/com.test.eluniversal.tagsuniversal D/GCMHelperUtil﹕ GCMHelperUtil.register in GCMHelperUtil.java:34 :: Registering with GCM server with senderId: 427411077190
03-31 16:58:30.053  18445-18467/com.test.eluniversal.tagsuniversal D/com.worklight.wlclient.api.WLPush﹕ WLPush.clearSubscribedEventSources in WLPush.java:596 :: Clearing notification subscriptions.
03-31 16:58:30.053  18445-18467/com.test.eluniversal.tagsuniversal D/com.worklight.wlclient.api.WLPush﹕ WLPush.clearSubscribedTags in WLPush.java:607 :: Clearing tag notification subscriptions.
03-31 16:58:30.053  18445-18467/com.test.eluniversal.tagsuniversal D/com.worklight.wlclient.api.WLPush﹕ WLPush.updateSubscribedTags in WLPush.java:635 :: Updating tag notification subscriptions.
03-31 16:58:30.063  18445-18546/com.test.eluniversal.tagsuniversal D/Connected﹕ Connected successfully
03-31 16:58:33.065  18445-18467/com.test.eluniversal.tagsuniversal D/WLClient﹕ WLClient.createInstance in WLClient.java:213 :: WLClient has already been created.
03-31 16:58:33.075  18445-18445/com.test.eluniversal.tagsuniversal W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 7095000 but found 4324038
03-31 16:58:33.075  18445-18467/com.test.eluniversal.tagsuniversal D/GCMClientFactory﹕ GCMClientFactory.useGooglePlayServices in GCMClientFactory.java:38 :: Failed to use Google Play Services becuase the return code is 2
03-31 16:58:33.075  18445-18467/com.test.eluniversal.tagsuniversal D/GCMClientFactory﹕ GCMClientFactory.getInstance in GCMClientFactory.java:28 :: Using GCMHelperClient
03-31 16:58:33.085  18445-18467/com.test.eluniversal.tagsuniversal W/GCMHelperClient﹕ GCMHelperClient.unregisterReceivers in GCMHelperClient.java:95 :: unregister:Receiver not registered: null
03-31 16:58:33.085  18445-18467/com.test.eluniversal.tagsuniversal W/GCMHelperClient﹕ GCMHelperClient.unregisterReceivers in GCMHelperClient.java:101 :: unregister:Receiver not registered: null
03-31 16:58:33.085  18445-18467/com.test.eluniversal.tagsuniversal W/com.worklight.wlclient.api.WLPush﹕ WLPush.unregisterReceivers in WLPush.java:792 :: unregisterReceivers:Receiver not registered: com.worklight.wlclient.api.WLPush$3@42e89a88
03-31 16:58:33.096  18445-18467/com.test.eluniversal.tagsuniversal E/com.worklight.wlclient.api.WLPush﹕ WLPush.isAbleToSubscribe in WLPush.java:414 :: Can't subscribe, notification token is not updated on the server
03-31 16:58:33.096  18445-18467/com.test.eluniversal.tagsuniversal D/wl.request﹕ WLRequestSender.run in WLRequestSender.java:40 :: Sending request http://172.16.134.52:10080/TagsUniversal/apps/services/api/TagsUniversalApp/Androidnative/init
03-31 16:58:40.383  18445-18467/com.test.eluniversal.tagsuniversal D/com.worklight.wlclient.api.WLPush﹕ WLPush.updateToken in WLPush.java:521 :: Registering at the GCM server.
03-31 16:58:40.393  18445-18467/com.test.eluniversal.tagsuniversal D/GCMHelperUtil﹕ GCMHelperUtil.register in GCMHelperUtil.java:34 :: Registering with GCM server with senderId: 427411077190
03-31 16:58:40.423  18445-18467/com.test.eluniversal.tagsuniversal D/com.worklight.wlclient.api.WLPush﹕ WLPush.clearSubscribedEventSources in WLPush.java:596 :: Clearing notification subscriptions.
03-31 16:58:40.423  18445-18467/com.test.eluniversal.tagsuniversal D/com.worklight.wlclient.api.WLPush﹕ WLPush.clearSubscribedTags in WLPush.java:607 :: Clearing tag notification subscriptions.
03-31 16:58:40.423  18445-18467/com.test.eluniversal.tagsuniversal D/com.worklight.wlclient.api.WLPush﹕ WLPush.updateSubscribedTags in WLPush.java:635 :: Updating tag notification subscriptions.
03-31 16:58:40.423  18445-18572/com.test.eluniversal.tagsuniversal D/Subscribed﹕ Subscribed successfully to push notifications