2015-08-19 80 views
-1

一切都是我的好GCM API密鑰和GCM發件人ID,但我得到失敗獲取GCM SenderId失敗(機器人)

E/com.appcelerator.aps.CCPushService:獲取GCM SenderId失敗。重試時間達到最大 。 [警告]:W/com.appcelerator.aps.CCPushService: 設備令牌爲空。

爲什麼?

請幫幫我!你有其他建議嗎?你有另一種方式嗎?

+0

你的警告清楚地說明了「設備令牌爲空」。 – Carnal

+0

不明白爲什麼我會得到這樣的錯誤。 「設備令牌爲空」。 面板的所有配置都沒有問題。 你有什麼建議嗎? – KaraEski

回答

0

試試看....,讓我知道在你GCM類檢查的天氣,這是存在或不存在如果不將它放在這裏

private void handleRegistration(Context context, String regId) 
{ 
    // TODO Auto-generated method stub 
    Utils.registrationId = regId; 
    SavePreferences("PUSHNOT",regId); 
    Log.e("", "registration id : "+regId); 


    //sendDeviceIdFuction(context,UtilsGcm.registrationId); 


} 
private void SavePreferences(String key, String value) 
{ 
    // TODO Auto-generated method stub 
    SharedPreferences sharedPreferences = getSharedPreferences("myPrefs", MODE_PRIVATE); 
    SharedPreferences.Editor editor = sharedPreferences.edit(); 
    editor.putString(key, value); 
    editor.commit(); 
} 

這裏保存登記後REGID在應用偏好嘗試檢索該首選項值而不是採用String regId。

OR

檢查了這一點https://developers.google.com/cloud-messaging/android/client

OR

這裏更具體的答案顯示你的代碼。

+0

非常感謝您的幫助。但我忘了說我已經開發了鈦。我正在開發鈦的JavaScript應用程序。 我想要獲取android設備令牌。 @Nikhil 'var deviceToken = null; CloudPush.retrieveDeviceToken({ \t \t \t成功:deviceTokenSuccess, \t \t \t錯誤:deviceTokenError \t \t}); function deviceTokenSuccess(e){ \t \t \t this.deviceToken = e.deviceToken; \t \t \t alert(「Device Token:」+ e.deviceToken); \t \t} function deviceTokenError(e){ alert('無法註冊推送通知!'+ e.error); \t \t}' – KaraEski

+0

@KaraEski檢查此: - https://github.com/liccowee/Google-Cloud-Messaging--Tanium-並接受我的答案,因爲這是你問什麼的答案 –

+0

@KaraEski有你檢查了上面的鏈接 –