Change Sender ID in Android GCM

780 Views Asked by At

I've deployed an app using an incorrect Project ID as the Sender ID for GCM. I changed it to the correct sender ID. (Note: The old ID is valid, just from the wrong project). But now Google doesn't send back an onRegister() broadcast after calling register() with the new sender ID.

I assume this is because the app is already registered with the old sender ID. I heard of 2 ways to correct this:

1) Call GCMRegistrar.unregister() to unlink from the old sender ID. But how do I detect that the app is running under the old sender ID? I don't want to call unregister on new installations, just the ones using the wrong ID.

2) Have the user uninstall the app and it should unregister from GCM automatically. This works on some devices, but on others it doesn't seem to work.

So how do I correctly unlink the app from the old sender ID, and register it with the new sender ID?

0

There are 0 best solutions below