Start a new topic

Android push notifications guide

Hi ,

I am followed the push guide for Android and I have some problems with the GCM Client Library approach. First of all on the link provided they say "Please use the GoogleCloudMessaging API instead of the GCM client helper library. The GCM server helper library is still valid."(but not the client side) Second I've looked into KinveyGCMService which extends GCMBaseIntentService which is also deprecated. Still I've used the gcm.jar approach and followed all the steps but my GCMReceiver that extends the KinveyGCMService doesn't get called. Can you help me with this issue and check if it's because of the new GoogleCloudMessaging API that Google tells to use?



Maybe this will help from my log:

V/Kinvey - Client﹕ GCM - Registration Id is empty, about to use GCMRegistrar for SenderIDs:

V/Kinvey - Client﹕ GCM Id -> 1xxxxxxxxxxxx

D/GCMRegistrar﹕ resetting backoff for com.wxxxxxxxxxx

V/GCMRegistrar﹕ Registering app com.wxxxxxxxx of senders 1xxxxxxxxxxx

V/Kinvey - Client﹕ GCM - just registered with the GCMRegistrar

V/GCMBroadcastReceiver﹕ onReceive:

V/GCMRegistrar﹕ Setting the name of retry receiver class to com.wxxxxxxxxx.GCMReceiver

V/GCMBroadcastReceiver﹕ GCM IntentService class: com.wxxxxxxxx.MyGCMReceiver

V/GCMBaseIntentService﹕ Acquiring wakelock

D/GCM﹕ Ignoring attempt to send heartbeat on dead connection.


I'm in the process of updating our GCM implementation now, and will have a release out next week using Google Play Services.

In the meantime, the gcm.jar implementation is working, as I've been using it to test backwards compatibility.

Looking at the log snippet you provided, it looks like registration is successful, although there is a lot of configuration involved to get push working.

Can you check a couple of things:

1. Visit, and ensure the User you are registered with has a field labelled `_messaging`, which should contain a JSON object containing the GCM id. This will ensure registration was successfull.

2. If the user was registered successfully, in the console, try a broadcast push -- make sure that if you enter a query the user matches the parameters.

3. And finally, the implementation provided in the push guide will only write the push message to the logs, which is very easy to miss. I would recommend using a `NotificationBuilder` to display a notification when the message arrives.
Thanks Edward for the hint with the "_messaging" field.

Now I have push notifications but now I have another problem with myClient.push().disablePush(). I am calling this method on logOut() and it doesn't disable the notifications. I've also checked the "_messaging" field after calling disablePush() and it has records in it. (I've tried to put that field to null but the app crashes ). Any hints on this?
Also another question related to the "_messaging" field:

This is a record from a single user after 3 x log in ,

















Is this the correct behavior or am I doing something wrong?

Same problem here.

How can the push notification subscriptions be disabled on Android?

Even after calling myClient.push().disablePush(), I'm still receiving notifications.

Login or Signup to post a comment