无法订阅,通知令牌未在服务器上更新
Can't subscribe, notification token is not updated on the server
在我的应用程序中,我看到以下消息:
Can't subscribe, notification token is not updated on the server
当我尝试在本地服务器中订阅基于标签的通知时。我不知道如何刷新本地服务器中的令牌。我正在使用 MobileFirst v7.0
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@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
发送到 android 工作室 logcat:
和其他在同一应用中记录意向订阅者其他标签:
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@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
从您的 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
Return代码2
是常量的值ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
从您的 Android SDK 管理器更新 Google Play services
并重建您的应用程序。
更新:
根据您的反馈,Google Play Services apk 在您的设备上似乎已过时运行你的应用程序。
更新了您的主要 Activity 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
中建议的
在我的应用程序中,我看到以下消息:
Can't subscribe, notification token is not updated on the server
当我尝试在本地服务器中订阅基于标签的通知时。我不知道如何刷新本地服务器中的令牌。我正在使用 MobileFirst v7.0
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@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
发送到 android 工作室 logcat:
和其他在同一应用中记录意向订阅者其他标签:
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@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
从您的 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
Return代码2
是常量的值ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
从您的 Android SDK 管理器更新 Google Play services
并重建您的应用程序。
根据您的反馈,Google Play Services apk 在您的设备上似乎已过时运行你的应用程序。
更新了您的主要 Activity 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
中建议的