Search code examples
androidpush-notificationibm-mobilefirstmobilefirst-server

Can't subscribe, notification token is not updated on the server


In my app I see the following message:

Can't subscribe, notification token is not updated on the server

When I try to subscribe for tag-based notifications in my server local. I don't know how to refresh the token in my local server. I'm using 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$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


Solution

  • From your the logcat you included it looks like the installed version of Google Play Services is out of date.

    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 code 2 is the value of the constant ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED

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

    Update Google Play services from your Android SDK Manager and rebuild your app.

    UPDATE:

    By your feedback it looks like the Google Play Services apk is outdated on the device you are running your app on.

    Updated your main Activity onResume code so it looks like this:

    @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();
        }
    
    }
    

    This is suggested by in Android's documentation https://developer.android.com/google/play-services/setup.html#ensure