Android Question New GCM registration procedures

tomazc

Member
Licensed User
Longtime User
I am starting to implement google cloud messaging into my app and have some worries regarding the deprecation of old device registration procedures.

In all the examples in the forum the device demo broadcasts a com.google.android.c2dm.intent.REGISTER intent to get the registration ID. I have looked at the google documentation and this method is not mentioned anywhere anymore. The old docs say you should use GCM.Register() to obtain the registration id/token, the service part seems to be the same as in the examples.

Last month however google has changed all the documentation and examples regarding device registration and receiving of messages. New documentation for the device part is here:
Implementing GCM Client on Android

We are now required to use InstanceID API (which requires Google play services, as does the GCM API) to obtain registration tokens, implement GcmReceiver to receive messages, GcmListenerService to process messages and InstanceIDListenerService to handle creation, rotation and updating of registration tokens.

I would very much like to hear your thoughts on this as I would not want to implement something that will stop working on the 30th of July when C2DM is turned off by google or six months later when google decides to turn off the old registration procedures.


Your thoughts are appreciated.

Erel if you are by any chance already looking into this please let me know.
 
Last edited:

tomazc

Member
Licensed User
Longtime User
I know it is based on GCM. But the previous GCM documentation states that you should register using the GoogleCloudMessaging.Register(SENDER_ID) method which is now deprecated aswell (doc here). I can not find any documentation that uses the broadcast intent method which leads me to believe that it was deprecated a while ago.

After doing a little bit more digging I have found that in fact the broadcast intent method was used in the old standalone GCM library which had a helper class GCMRegistrar whose Register method did exactly as in you example, that is broadcast an intent for registration. The link provided above is for the GCM included in Google Play Services which has a different class GoogleCloudMessaging (this deprecated the old intent method) with register and unregister methods that are both now deprecated.

Hence my confusion and worries.

I now actually went and checked the source for GoogleCloudMessaging class and it seems it still uses intents but with a StartService(Intent) call which I assume is the same as broadcasting it. So I guess using this method is OK for now since it has only been deprecated last month.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
I am starting to implement google cloud messaging into my app and have some worries regarding the deprecation of old device registration procedures.

In all the examples in the forum the device demo broadcasts a com.google.android.c2dm.intent.REGISTER intent to get the registration ID. I have looked at the google documentation and this method is not mentioned anywhere anymore. The old docs say you should use GCM.Register() to obtain the registration id/token, the service part seems to be the same as in the examples.

Last month however google has changed all the documentation and examples regarding device registration and receiving of messages. New documentation for the device part is here:
Implementing GCM Client on Android

We are now required to use InstanceID API (which requires Google play services, as does the GCM API) to obtain registration tokens, implement GcmReceiver to receive messages, GcmListenerService to process messages and InstanceIDListenerService to handle creation, rotation and updating of registration tokens.

I would very much like to hear your thoughts on this as I would not want to implement something that will stop working on the 30th of July when C2DM is turned off by google or six months later when google decides to turn off the old registration procedures.


Your thoughts are appreciated.

Erel if you are by any chance already looking into this please let me know.
You gotta love Google, always changing stuff around, Crap!
Does this mean the old way of implementing GCM does not work any more?

Crap!
and more Crap!

:mad::confused::(o_O
 
Upvote 0

fixit30

Active Member
Licensed User
Longtime User
Does this mean the old way of implementing GCM does not work any more?

All I can say is that GCM is still working at the moment as my App uses it.

The question is for how long???
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
All I can say is that GCM is still working at the moment as my App uses it.

The question is for how long???
Oh well, that's good news!, but you're right, the question is for how long?

More Crap!
 
Upvote 0

fixit30

Active Member
Licensed User
Longtime User
I would really like to see an example of implementing the new GCM framework.

onTokenRefresh looks like exactly what I need. (Not sure this was available in the current implementation)
 
Upvote 0

tomazc

Member
Licensed User
Longtime User
I think that in the current implementation if GCM decided to issue a new RegId it would broadcast a com.google.android.c2dm.intent.REGISTRATION and your service would capture it.

I might create a library for the new registration and receiver if I get the development time for it approved.
 
Upvote 0

tomazc

Member
Licensed User
Longtime User
Alas the decision was made to go with the old way for now.
Hope somebody else finds the time to tackle this.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
hello, any news about this ? The current method (Erel tutorial) is still working on my device but it seems I have troubles in GCM registration of some customer devices.
I don't have them in hands to investigate, actually I see I can't send them messages from the console, the Java error says "No Id found for name ...." so I suppose the registration of those devices has failed.

(edit) I don't suppose, I'm sure the registration has failed because that devices are not in the list obtained with B4a_Gcm GetAll
 
Last edited:
Upvote 0

derez

Expert
Licensed User
Longtime User
I'm using Erel's pushService to register and it works although I can't get the console to work because it can't find the name.
Notifications are sent !
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Not since last week
 
Upvote 0
Top