Search code examples
androidandroid-c2dm

Android C2DM-Error


Registration from device (android phone running 2.2) is not working.

In one emulator im getting the registration id and if i try with another emulator(Google API version:8,same as the first).Im getting this warning. How to handle it.

LogCat shows the following warning -

07-27 11:54:23.621: WARN/ActivityManager(73): Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf (has extras) }: not found

I used the vogella site for the implementation of the C2DM. Its sometimes works n sometimes doesn't. Why?

Thanks.


Solution

  • Inorder to c2dm to work:
    1.Device must be running Android 2.2 or higher.
    2.Market application has to be installed on the device(necessary for a real device but not necessary for the emulator.)
    3.Users must be signed in with his google account.(settings\accounts...).
    You should check out the C2DM Framework web site it explains the necessities.

    --It requires devices running Android 2.2 or higher that also have the Market application installed. However, you are not limited to deploying your applications through Market.
    --It uses an existing connection for Google services. This requires users to set up their Google account on their mobile devices.

    Here is a sample code:

        Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
        registrationIntent.putExtra("app", PendingIntent.getBroadcast(applicationContext, 0, new Intent(), 0));
        registrationIntent.putExtra("sender",[email protected]);
        ComponentName name = applicationContext.startService(registrationIntent);