【问题标题】:Getting GCM SenderId failed (android)获取 GCM SenderId 失败 (android)
【发布时间】:2015-08-19 07:52:54
【问题描述】:

一切正常 我的 GCM API 密钥和 GCM 发件人 ID 但我失败了

E/com.appcelerator.aps.CCPushService:获取 GCM SenderId 失败。最大限度 重试时间到达。 [警告]:W/com.appcelerator.aps.CCPushService: 设备令牌为空。

为什么?

请帮助我!你有什么其他的建议吗?你有别的办法吗?

【问题讨论】:

  • 您的警告说得很清楚,“设备令牌为空”。
  • 不明白为什么我会犯这样的错误。 “设备令牌为空”。面板上的所有配置都没有问题。您还有其他建议吗?

标签: android mobile titanium google-cloud-messaging


【解决方案1】:

试一试....让我知道在你的 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 在应用首选项中尝试检索该首选项值而不是获取字符串 regId。

看看这个https://developers.google.com/cloud-messaging/android/client

在此处显示您的代码以获得更具体的答案。

【讨论】:

  • 非常感谢您的帮助。但我忘了说我已经开发了一个钛合金。我正在开发钛的 JavaScript 应用程序。我想获得 android 设备令牌。 @Nikhil var deviceToken = null; CloudPush.retrieveDeviceToken({ success : deviceTokenSuccess, error : deviceTokenError }); function deviceTokenSuccess(e) { this.deviceToken = e.deviceToken; alert(" Device Token: " + e.deviceToken); } function deviceTokenError(e) { alert(' Failed to register for push notifications! ' + e.error); }
  • @KaraEski 检查这个:- github.com/liccowee/Google-Cloud-Messaging--Titanium- 并接受我的回答,因为这就是你所问的答案
  • @KaraEski 你检查过上面的链接吗
  • 是的,我正在寻找,但我看到了这个链接。 @Nikhil
猜你喜欢
  • 2014-05-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-28
  • 1970-01-01
相关资源
最近更新 更多