본문 바로가기
프로그래밍 놀이터/안드로이드, Java

[android] at GingerBread device GCM register returns SERVICE_NOT_AVAILABLE

by 돼지왕 왕돼지 2013. 10. 15.
반응형


 android, 

 @ GingerBread device, GCM register returns SERVICE_NOT_AVAILABLE

 


[En]


<Error Message>

java.io.IOException: SERVICE_NOT_AVAILABLE

at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)


Even though GCM register function returns SERVICE_NOT_AVAILABLE, registration process is actually done well. You can check the registration id, a.k.a. device token, via Broadcast Receiver with following code.


<Manifest>

<receiver

   android:name="YOUR_PACKAGE_NAME.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="YOUR_PACKAGE_NAME" />

      </intent-filter>

</receiver>


<!-- Permissions are same with the previous gcm.jar use case -->


<Broadcast Receiver>

String deviceToken = intent.getStringExtra( "registration_id" );







[Kr]


<에러 메세지>

java.io.IOException: SERVICE_NOT_AVAILABLE

at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)


아래와 같이 manifest 를 정의하면, ( 이전 permission과 함께 되어 있다면 ) service not available 이 return 되어도, receiver 에 registration id ( device token 으로 알려진 ) 가 들어오긴 한다.


<Manifest>

<receiver

   android:name="YOUR_PACKAGE_NAME.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="YOUR_PACKAGE_NAME" />

      </intent-filter>

</receiver>


<!-- Permissions are same with the previous gcm.jar use case -->


<Broadcast Receiver>

String deviceToken = intent.getStringExtra( "registration_id" );


어떤가 해결되었는가?










반응형

댓글