简体   繁体   中英

Android GCM Different Registration ID

I'm wondering something about RegistrationID

var regid = gcm.register(SenderID);

Technically, when register method run, gcm takes SenderID and probably some unique value of my device then creates RegistrationID

In my scenario, i've instant messaging app that uses gcm. Now i am getting an account in that app, then gcm sends RegistrationID thats ok. If i wanted to get new account on same device, it does not give new RegistrationID normally.

How can gcm give diffrent RegistrationID for same application and same device ?

The registration ID is supposed to be unique per app.

Maybe what you need is to add some checks for the signed in user for your app to behave differently when you receive the notification.

for example in onHandleIntent method

@Override
protected void onHandleIntent(Intent intent) {
   if(userId==user_id){
     //display notification
   }
}

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