2013-05-28 3 views
1

내 코드 등록 방법은 NULL 반환 나는 점점 오전 예외가 SERVICE_NOT_AVAILABLE입니다GoogleCloudMessaging.register - 다음 SERVICE_NOT_AVAILABLE 오류

protected String doInBackground(Void... params) { 
if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS){ 
GoogleCloudMessaging gcm_instance = GoogleCloudMessaging.getInstance(context); 
String reg_id = null; 
int attempts = 0; 
while(attempts < 3 && reg_id == null){ 
try{ 
    reg_id = gcm_instance.register(SENDER_ID); 
    return reg_id; 
} catch (IOException e) {   
    e.printStackTrace(); 
} 
attempts++; 
} 
} 
return null; 
} 

입니다. 보낸 사람 ID를 확인하고 인터넷 연결이 내 장치에서 완벽하게 작동하는지 확인합니다.

도와주세요.

답변

0

나는 똑같은 문제가있었습니다. 해결책은이 링크에서 설명한대로 도우미 라이브러리를 사용하는 것이 었습니다. http://developer.android.com/google/gcm/helper.html#android-app

기록을 위해 사용중인 장치는 Android 4.0.3을 실행하고있었습니다. 기기에 올바른 Google 계정을 설정했습니다 (결국).

이제 등록 할 수 있습니다. 다음 단계 : 실제로 메시지를 보낼 수 있는지 확인하십시오. D

행운을 빕니다.