I am using the Emulator of version 8. and when i am trying to register the Android Application then it will gives the null registration ID. Please help me to resolve this issue. How can i register the Android Application with C2DM.My code is to register the App.
Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
registrationIntent.putExtra("app", PendingIntent.getBroadcast(startCode.this, 0, new Intent(), 0)); // boilerplate
registrationIntent.putExtra("sender", "12786@gmail.com");
startService(registrationIntent);
handleRegistration(getApplicationContext(), registrationIntent);
private void handleRegistration(Context context, Intent intent) {
String registration = intent.getStringExtra("registration_id");
if (intent.getStringExtra("error") != null) {
// Registration failed, should try again later.
Log.e("ERROR", "ERROR");
} else if (intent.getStringExtra("unregistered") != null) {
// unregistration done, new messages from the authorized sender will be rejected
Log.e("unregistered", "unregistered");
} else if (registration != null) {
// Send the registration ID to the 3rd party site that is sending the messages.
// This should be done in a separate thread.
// When done, remember that all registration is done.
Log.e("registration", registration);
}
}