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" );
어떤가 해결되었는가?
'프로그래밍 놀이터 > 안드로이드, Java' 카테고리의 다른 글
[android] apply different colors on the texts in the textview using xml (0) | 2013.10.21 |
---|---|
[android] how can I detect if notification clear button is clicked? (0) | 2013.10.16 |
[android] HttpClient vs. HttpURLConnection (0) | 2013.10.11 |
[Java] JDBC, Database 연결하여 사용하기 (0) | 2013.10.11 |
[android] how can I know if there is any application which can handle an intent. (0) | 2013.10.10 |
댓글