简体   繁体   中英

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

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.

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM