我已经尝试了一些论坛页面并通过stackoverflow搜索同样的事情,但我没有找到解决方案.
我使用以下代码生成GCM通知的注册ID.但我得到一个空字符串作为注册ID:
GCMRegistrar.checkDevice(本); GCMRegistrar.checkManifest(本);
if(GCMRegistrar.isRegistered(this)){Log.d("info",GCMRegistrar.getRegistrationId(this)); }
Run Code Online (Sandbox Code Playgroud)regId = GCMRegistrar.getRegistrationId(this); Log.v("log", " register id oslo : " + regId); if (regId.equals("")) { // replace this with the project ID GCMRegistrar.register(this, "718437041388"); Log.d("info", GCMRegistrar.getRegistrationId(this)); } else { Log.d("info", "already registered as" + regId); }
请帮帮我,告诉我,如果我有什么不对劲.
先谢谢你,Nirav.