Android Question New GCM registration procedures

Discussion in 'Android Questions' started by tomazc, Jun 16, 2015.

  1. tomazc

    tomazc Member Licensed 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: Jun 16, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. tomazc

    tomazc Member Licensed 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.
     
  4. walterf25

    walterf25 Well-Known Member Licensed User

    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
     
  5. fixit30

    fixit30 Active Member Licensed 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???
     
  6. walterf25

    walterf25 Well-Known Member Licensed User

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

    More Crap!
     
    fixit30 likes this.
  7. fixit30

    fixit30 Active Member Licensed 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)
     
  8. tomazc

    tomazc Member Licensed 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.
     
  9. tomazc

    tomazc Member Licensed User

    Alas the decision was made to go with the old way for now.
    Hope somebody else finds the time to tackle this.
     
  10. marcick

    marcick Well-Known Member Licensed 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: Sep 18, 2015
  11. derez

    derez Expert Licensed 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 !
     
  12. marcick

    marcick Well-Known Member Licensed User

    actually it works again fo rme .. mistery ....
     
  13. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    Is there any news about this?
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    The current solution (based on GCM not C2DM) works properly. Did you encounter any issue?
     
  15. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    Few problems are occurring about registration of ID. How the register() was deprecated I hoped migrate the implementation of the gcm API
     
  16. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    Is there any news about this?
     
  17. DonManfred

    DonManfred Expert Licensed User

    Not since last week
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice