我曾尝试过浏览一些论坛页面和在stackoverflow上搜索相关的内容,但是没有找到答案。
我使用下面的代码为GCM通知生成 注册 ID。但是我得到了一个空字符串作为注册 ID:
GCMRegistrar.checkDevice(this); GCMRegistrar.checkManifest(this);
if (GCMRegistrar.isRegistered(this)) { Log.d("info", GCMRegistrar.getRegistrationId(this)); }
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。