Skip to content Skip to sidebar Skip to footer

Why Is My Own Sender Id Getting Back An Invalidregistration Message?

I have been working on implementing GCM in an application and based on Google's examples have been able to get it to work. However, when I try to use my own sender ID and scope, I

Solution 1:

Per the GCM Android Client guide, your InstanceID token call should look like

InstanceIDinstanceID= InstanceID.getInstance(this);
Stringtoken= instanceID.getToken(
    getString(R.string.gcm_defaultSenderId),
    GoogleCloudMessaging.INSTANCE_ID_SCOPE, 
    null);

Note that you must use GoogleCloudMessaging.INSTANCE_ID_SCOPE as the second parameter - InstanceID is more general than just GCM, hence why it is a parameter that can take any String, but GCM specifically requires that authorization scope.

Post a Comment for "Why Is My Own Sender Id Getting Back An Invalidregistration Message?"