2

i got confused by gcm today. I dont know if my registrationid is correct. I got characters and a colon in front of a registrationid starting with APA. The Pattern is xXXXxxX:APA... . I implemented google cloud messaging for a android client using the example from here: https://developers.google.com/cloud-messaging/android/client . If i use a older implementation (for example with GCMRegistrar) i only get a registration id starting with APA. Till now i though a registration id has to start with APA.

Is the stuff before the colon some tokenspecific stuff? Do i have to pass the full token to the webservice or is it okay if i cut the chars before the colon and send the registration starting with APA?

elpatricko
  • 488
  • 5
  • 17
  • 1
    BTW: GCM is deprecated. Use FCM – Marcin Orlowski Jul 29 '16 at 21:24
  • 3
    GCM is not deprecated. they will support the current version of gcm but new features will be added to fcm as google announced. https://developers.google.com/cloud-messaging/faq – ugur Jul 29 '16 at 21:35
  • 1
    @Igor It says gcm register is deprecated. I said gcm is not deprecated as a response to Marcin's answer. – ugur Dec 21 '16 at 15:00

2 Answers2

4

GCM Registration Token is equal to registration_id. As I mentioned in my answer here:

An FCM Token, or much commonly known as a registrationToken like in . As described in the GCM docs:

An ID issued by the GCM connection servers to the client app that allows it to receive messages. Note that registration tokens must be kept secret.

Different terms point to the same thing. The format for the registration token may also vary as seen this answer:

The GCM registration token is usually around 140 chars in length, and can contain colons, underscores and hyphens. Maximum size is supposed to be 4k.

Though I'm not entirely sure with regards to the character length, I think I've read on a post here somewhere that it may exceed that number. Do search around.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
  • AFAIK, yeah. I think I've encountered a registration token like that before.. Do try it. You can never know for sure if you don't test it out. :) – AL. Jul 30 '16 at 11:53
1

gcm.register() is deprecated. use instance id method with token instead.

https://developers.google.com/cloud-messaging/android/legacy-regid

GCM register() is deprecated starting May 28, 2015. New app development should use the Instance ID API to handle the creation, rotation, and updating of registration tokens. For more information, see Registering Client Apps and Set up a GCM Client App on Android.

ugur
  • 3,604
  • 3
  • 26
  • 57
  • I know that . register() is deprecated. I didn't used it. I used the instance id. Like in the link i posted is shown. My question is only about the Chars before the Colon an the Colon itself. – elpatricko Jul 29 '16 at 21:47
  • 1
    use tokens insstead of former regids – ugur Jul 29 '16 at 22:06