D
D
Developer2013-11-25 14:56:37
Android
Developer, 2013-11-25 14:56:37

Why is an empty DeviceID returned when enrolling in GCM (C2DM) on a device?

I register an Android device in GCM (C2DM). Everything is fine in the emulator, I get the deviceId and successfully send messages to it.
But when I install the application on a live phone, the deviceId is empty. It doesn't throw any errors, it just returns an empty value.

GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
deviceId = GCMRegistrar.getRegistrationId(this);
if (deviceId != null && !deviceId.equals("")) { 
  GCMRegistrar.register(this, "xxxxxxxxxxxxx" );
  deviceId = GCMRegistrar.getRegistrationId(this);
}

Why can this be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stepan, 2013-11-25
@samodum

It might happen on first start. I don’t know the reasons, but our programmer complained about this more than once.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question