Android的GCM:GCMRegistrar给空注册ID [英] Android GCM : GCMRegistrar gives empty registration ID
本文介绍了Android的GCM:GCMRegistrar给空注册ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我跟 http://developer.android.com /guide/google/gcm/gs.html#server-app </a>的在我的应用程序中实现GCM
I have followed http://developer.android.com/guide/google/gcm/gs.html#server-app to implement GCM in my application
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
if (GCMRegistrar.isRegistered(this)) {
Log.d(TAG, GCMRegistrar.getRegistrationId(this));
}
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, sender_id);
Log.d(TAG, "Registration id : "+GCMRegistrar.getRegistrationId(this));
}
else {
Log.d("info", "already registered as" + regId);
}
这是返回空字符串作为注册ID 还有什么是需要得到注册ID ??
that returns empty string as registration ID what else is needed to get the registration ID??
推荐答案
创建使用谷歌控制台具有相同名称的新项目作为Eclipse应用程序的名字帮我解决这个问题。
Creating a new project using google console with the same name as application's name in eclipse helped me to solve this problem.
这篇关于Android的GCM:GCMRegistrar给空注册ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文