ほげほげ

プログラミング、英会話、ヨガ、料理などの備忘録など。

Android GCM で SERVICE_NOT_AVAILABLE

レジストレーションIDの取得時にSERVICE_NOT_AVAILABLEとなって、レジストレーションIDの色ができなかった。

マニフェストのreceiverとserviceのパッケージ名を省略していたのが、原因でした。

OK

    <receiver
      android:name="<ちゃんと書く>.GcmBroadcastReceiver"
      android:permission="com.google.android.c2dm.permission.SEND" >
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <category android:name="<ちゃんと書く>.gcm" />
      </intent-filter>
    </receiver>
    <service android:name="<ちゃんと書く>.GcmIntentService" />
  </application>

NG

    <receiver
      android:name=".GcmBroadcastReceiver"
      android:permission="com.google.android.c2dm.permission.SEND" >
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <category android:name="<ちゃんと書いてた>.gcm" />
      </intent-filter>
    </receiver>
    <service android:name=".GcmIntentService" />
  </application>