private void registerClient()
{
try {
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals(""))
{
registrationStatus = "Registering...";
GCMRegistrar.register(this, "517739810110");
regId = GCMRegistrar.getRegistrationId(this);
registrationStatus = "Registration Acquired";
sendRegistrationToServer();
}
else
{
registrationStatus = "Already registered";
}
}
catch (Exception e)
{
e.printStackTrace();
registrationStatus = e.getMessage();
}
}
I can obtain the registration id from GCM successfully for some Android devices but not for all Android devices. The GCM returns empty registration id for some Android devices. I am using the GCM.jar file as a third party tool which returns the registration id. All the permissions are correctly defined in the manifest file. The sender id is correct. The API key is correct.