• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Notifications Issue

sweebo

Lurker
Apr 14, 2012
4
0
Hello, i'm followed the following tutorial:

Android Cloud to Device Messaging (C2DM) - Tutorial

However when i run my android application REGISTRATION doesn't through google doesn't seem to be happening, i'm refering to the following code:

public void register(View view)
{
Context context = getApplicationContext();

Log.v("C2DM", "start registration process");
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
intent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));

// Sender currently not used
intent.putExtra("sender", "uni@gmail.com");
startService(intent);
Log.v("C2DM", "start intent");
}

public void showRegistrationId(View view)
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String string = prefs.getString(AUTH, "n/a");
Toast.makeText(this, string, Toast.LENGTH_LONG).show();
Log.d("C2DM RegId", string);

}

The log doesn't show any errors however my button to print out the RegId shows the default value of n/a and it seems no value is being recived from google.

Any help would be very much appreciate. Thanks
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones