2

i am using the below code to get the DCM Registration token

 String token = "NoREG";
    try {
        InstanceID instanceID = InstanceID.getInstance(getApplicationContext());
         token = instanceID.getToken("xxxxxxxxxxxxxx",
                GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
        Log.i(TAG, "GCM Registration Token: " + token);
    } catch (Exception e) {
        Log.d(TAG, "Failed to complete token", e);
    }

i am getting the registration token in an unusual format like

dsYKKXPzztU:APA91bH2J5OqK9OHEp7p5RUJ46fO_zPAEhEgPugJBviEqAbPyFhozMoVh1Npk_s_7wwyzaJ0LjiFki3PYFZHByw4KdA6Ke0XdudOqe4LPhNPA-Y2nbblRHLPhEp3dWyjqCTEsQhwHw24

as you can see it contains a colon, which makes me feel some thing is wrong. is this format correct?? please help

Tim
  • 41,901
  • 18
  • 127
  • 145
RAZ
  • 43
  • 5
  • Have you tried whether it worked? If it does, it is correct. You shouldn't worry about how Google's API is functioning. – Bert Peters Sep 27 '15 at 16:37
  • Yes I believe they are actually required to have a colon after the 10th or so character. The absence of the colon, now that would be worrisome – Tim Oct 01 '15 at 12:14

1 Answers1

3

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.

Magnus Smith
  • 5,895
  • 7
  • 43
  • 64
  • Having said this, I now see that none of my recent tokens (from Android devices) have colons in them! However, GCM is still working OK for me. – Magnus Smith Feb 04 '16 at 09:47
  • Hi @MagnusSmith. Is this still the case? If so, I was wondering if you can point me to a documentation? :) – AL. Jun 29 '16 at 06:48
  • 1
    These were observations from my own code. Sorry I did not record the documentation links I used. I see now that some people debate the 4k size, so perhaps I am wrong. – Magnus Smith Jun 30 '16 at 08:38