1

I've noticed that GCM tokens appear to use : only once, and always in the same (or close-to-same) position in a token string. This suggests that it's a delimiter of some sort. And that the parts on either side of the : have different meaning. Would anyone know what the two parts represent?

AL.
  • 36,815
  • 10
  • 142
  • 281
Julian A.
  • 10,928
  • 16
  • 67
  • 107

1 Answers1

1

I've tested this out for Android before and concluded that:

<first_part>:<second_part>

The first part is the ID for the app instance, which is why calling getId() returns the same value:

Returns a stable identifier that uniquely identifies the app instance.

and the second part is the actual token for the corresponding authorized entity - i.e. sender project. Note that its possible for two different tokens to be generated from the same device, provided you are usimg multiple senders.

AL.
  • 36,815
  • 10
  • 142
  • 281
  • When you say `... its possible for two different tokens to be generated from the same device, provided you are usimg multiple senders.`, do you mean two sender projects sending notifications to the same app instance? – Julian A. Apr 21 '18 at 21:11
  • I've noticed that some tokens don't have an app instance id prefix. Do you know if this is because in the past the tokens used to not include it? – Julian A. Apr 21 '18 at 22:20
  • 1
    For the two sender projects -- yes. For the app instance id prefix -- It's possible. This wasn't always the format for registration tokens before (back in GCM). So yeah, it could be a really old token. It was actually advised that [the token format is subject to change in the future](https://stackoverflow.com/a/12502351/4625829) so I didn't put too much thought into the structure anymore. – AL. Apr 22 '18 at 01:46