1
votes

In GCM Advanced Topics, under the heading Why you should rarely unregister, there are two assertions concerning registration that appear to be in conflict.

First:

"A regID maps an app to a device. It isn't associated with a particular logged in user."

I take it that the mapping is a one-to-one correspondence (or should be).

Second:

"Your app server should maintain a mapping between the current user and the regID."

However, the first statement asserts no such association. (Presumably the "current user" is "logged in" with the app server, but the documentation does not specify this.)

My question is whether the documentation should be amended as follows:

  1. GCM maintains a mapping from regIDs to a device. [The term "mapping" most likely means functional relation, but this is not specified.]

  2. GCM does not maintain a mapping from regIDs to the current user.

  3. There is assumed to be a one-to-one correspondence between the current user and the regID.
  4. Your (3rd party) application server should maintain a mapping between the current user and the regID.

How do developers interpret the first and second statements?

1

1 Answers

2
votes

I see no inconsistency. As stated by the first quote, a Registration ID is assigned for each application on each device (meaning different applications on the same device have different Registration IDs and on different devices the same application has different Registration IDs).

Since GCM doesn't care which user is logged in to a specific app on a specific device (such a login is an application specific logic that GCM knows nothing about), an application that has a login feature should keep track (in the 3rd party server) of which user is currently logged-in on each device, and associate the Registration ID with that user (so that the server sends only GCM messages relevant to that user to the device on which the user is logged-in).

As for the statements you wrote :

  1. That's in-accurate. The mapping is (as stated by Google) between application and device.
  2. That's correct
  3. That's up to the logic of a specific application to determine (an application doesn't necessarily have a login feature).
  4. That's true, assuming the application has a login feature.