I am working on Push notification,i have registered my application in google console. when i fetch device id, it returns different device id everytime in onRegistration() of GCMIntentService class.Please Help me regarding this.
@Override protected void onRegistered(Context context, String registrationId)
{
Log.i(TAG, "Device registered: regId = " + registrationId);
SavePreferences(registrationId,context);
//Log.d("NAME", MainActivity.name);
//ServerUtilities.register(context, MainActivity.name, MainActivity.email, registrationId);
}
It is a normal situation. You should NOT register device continuously. Register and save
deviceIdto somewhere (e.g. SharedPreferences) and the next time check if you havedeviceIdon SharedPreferences.I think it's better for you to follow the article: https://developer.android.com/google/gcm/client.html
It has everything (almost) you need to.