小编the*_*der的帖子

应用注册ID未在GCM Android中生成

我已经尝试了一些论坛页面并通过stackoverflow搜索同样的事情,但我没有找到解决方案.

我使用以下代码生成GCM通知的注册ID.但我得到一个空字符串作为注册ID:

GCMRegistrar.checkDevice(本); GCMRegistrar.checkManifest(本);

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);
}
Run Code Online (Sandbox Code Playgroud)

请帮帮我,告诉我,如果我有什么不对劲.

先谢谢你,Nirav.

notifications android registration google-cloud-messaging

3
推荐指数
2
解决办法
9314
查看次数