Rakib
Rakib

Reputation: 13085

How unique is a GCM registration ID for an Android app with multiple accounts?

Let's say, for example, a device has an app with 2 accounts signed in (a typical use case of having multiple gmail accounts on the same device). Let's say we have a Personal account and a Work account.

When a user signs into the app, the app requests for a GCM registration ID from the GCM servers, and then the app sends this GCM registration ID to the App Servers. The app server will store this GCM registration ID in its database. This repeats every time someone signs into the app.

How uniquely will the GCM registration IDs be generated by the GCM servers?

deviceA, appX, accountHome = regIdAX
deviceA, appX, accountWork = regIdAX

or

deviceA, appX, accountHome = regIdAXHome
deviceA, appX, accountWork = regIdAXWork

Upvotes: 2

Views: 502

Answers (3)

calum_b
calum_b

Reputation: 243

A GCM ID is unique to one application running on one device. It does not matter which user is signed into that application, if any.

Similar questions/answers here:

Upvotes: 2

Ahmed Hegazy
Ahmed Hegazy

Reputation: 12615

The correct formula is

deviceA, appX, regIdX(no matter how many accounts internally found)
deviceA, appY, regIdY
deviceB, appX, regIdX1

It's per device per app and not related to any app internal work.

Upvotes: 2

Efop
Efop

Reputation: 1

The regid (token) is 140 char long so i think it is pretty unique... I cant exacly tell how differ on same device different account as i have 2 device 2 account. I think the regid made by some hashing algoritm, because im registered/unregistered some times but always got the same regid on same device. A read somewhere that Google will invalidate the regid after 6 month.

Upvotes: -1

Related Questions