2016-04-10 27 views
1

我與GCM工作,和我設法接收到的註冊標記,但當應用數據被刪除 - 這是在登記令牌是這樣的一個refreshed-我得到這個錯誤被我逼瘋了:的Android - GCM:無法完成令牌刷新

04-10 23:51:39.819 23048-26249/com.adall.teambuilding D/RegIntentService: Failed to complete token refresh 
                     java.io.IOException: SERVICE_NOT_AVAILABLE 
                      at com.google.android.gms.iid.zzc.zzb(Unknown Source) 
                      at com.google.android.gms.iid.zzc.zza(Unknown Source) 
                      at com.google.android.gms.iid.InstanceID.zzc(Unknown Source) 
                      at com.google.android.gms.iid.InstanceID.getToken(Unknown Source) 
                      at com.adall.teambuilding.gcm.RegistrationIntentService.onHandleIntent(RegistrationIntentService.java:52) 
                      at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:145) 
                      at android.os.HandlerThread.run(HandlerThread.java:61) 

由於網站我在做指數試圖重試建議,但它不工作
我應該怎麼做才能解決這個問題?
THX anticipately

+0

的實例時使用getApplicationContext()發佈您的代碼和清單請 –

+0

我得到了同樣的錯誤。但奇怪的是,經過第二次嘗試,它的工作。 –

回答

0

一個similar issue有人提出被他們利用Thread.sleep解決了這個問題。另一個答案建議當獲得GoogleCloudMessagingGoogleCloudMessaging.getInstance(getApplicationContext())