简体   繁体   中英

Android GCM: Is intent.getStringExtra(EXTRA_REGISTRATION_ID) unique for every device?

I'm just curious if the string generated from intent.getStringExtra(EXTRA_REGISTRATION_ID) from GCM class GCMBaseIntentService are all unique for each android device? And how is it been generated?

The registration ID is created by the GCM server and is unique to a specific app running on a specific device.

You can read more here: http://developer.android.com/guide/google/gcm/gs.html#android-app

onRegistered(Context context, String regId): Called after a registration intent is received passes the registration ID assigned by GCM to that device/application pair as parameter. Typically, you should send the regid to your server so it can use it to send messages to this device.

And here: http://developer.android.com/guide/google/gcm/gcm.html#arch

Registration ID

An ID issued by the GCM servers to the Android application that allows it to receive messages. Once the Android application has the registration ID, it sends it to the 3rd-party application server, which uses it to identify each device that has registered to receive messages for a given Android application. In other words, a registration ID is tied to a particular Android application running on a particular device.

Also that string is not generated by the code your referenced, instead it is generated on the GCM servers and read from the intent by that code.

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