我已经遵循http://developer.android.com/guide/google/gcm/gs.html#server-app在我的应用程序中实现了gcm

                    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??

最佳答案

设备未成功注册时会出现空字符串。可能有以下原因
为它-
将gcm代码放入应用程序包中。[您可以制作另一个与应用程序包同名的包]
正确设置所有权限。

07-28 12:32