2

I was trying to use GCM to have push-notification in my app. I called GCMRegistrar.register(this, SENDER_ID), but I got an error.

My manifest file:

   <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
            <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
            <category android:name="com.salamworld"/>
        </intent-filter>
    </receiver>
    <service android:name=".GCMIntentService"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<permission android:name="my.package.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="my.package.permission.C2D_MESSAGE"/>
<uses-sdk android:minSdkVersion="8"/>

And here's the error:

DEBUG/GCMBaseIntentService(423): Registration error: ACCOUNT_MISSING

My GCMIntentService class:

public class GCMIntentService extends GCMBaseIntentService{

    public GCMIntentService() {
        super();
    }

    @Override
    protected void onMessage(Context context, Intent intent) {
    }

    @Override
    protected void onError(Context context, String errorId) {
    }

    @Override
    protected void onRegistered(Context context, String registrationId) {
        Log.d("@R@", registrationId);
    }

    @Override
    protected void onUnregistered(Context context, String registrationId) {
    }
}
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179

1 Answers1

7

This exception comes when you don't have a Google Account in your device,

ACCOUNT_MISSING - There is no Google account on the phone. The Android application should ask the user to open the account manager and add a Google account. Fix on the device side.

Lalit Poptani
  • 67,150
  • 23
  • 161
  • 242