1. Download our Official Android App: Forums for Android!

Apps Notifications Issue

Discussion in 'Android Development' started by sweebo, May 9, 2012.

  1. sweebo

    sweebo Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Apr 14, 2012

    Apr 14, 2012
    4
    0
    5
    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
     

    Advertisement

Share This Page

Loading...