2016-04-10 24 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())