【问题标题】:GCM stuck on register on 2.3.3 Gingerbread deviceGCM 卡在 2.3.3 Gingerbread 设备上的寄存器上
【发布时间】:2013-06-10 20:20:23
【问题描述】:

出于某种原因,使用“GCMRegistrar.register(this, SENDER_ID);”适用于 4.0 + 设备。 但是,它停留在以下消息,而没有收到来自 Google 的更多 GCM 通知。

注册应用程序(我的包)的发件人(我的 api #)

1) 清单和接收器应该是正确的,因为它在 4.2.1 上工作。

2) 我有 google play 并在 2.3.3 设备上与 google 帐户关联

我已经搜索了几天,但找不到答案。 任何人都知道什么是错的或有同样的问题?

谢谢

【问题讨论】:

    标签: android google-cloud-messaging android-2.3-gingerbread


    【解决方案1】:

    我发现只是因为我没有正确设置接收者的类别。

    由于我将所有源代码放在一个库项目中并在每个单独的应用程序中引用它,我需要重命名清单中的 3 个不同位置。

    1)

    <permission
            android:name="digital.dispatch.mobilebooker.base.permission.C2D_MESSAGE"
            android:protectionLevel="signature" />
    

       <permission
            android:name="digital.dispatch.mobilebooker.(my app name).permission.C2D_MESSAGE"
            android:protectionLevel="signature" />
    

    2)

    <uses-permission
            android:name="digital.dispatch.mobilebooker.base.permission.C2D_MESSAGE" />
    

    3)

    <category android:name="digital.dispatch.mobilebooker.base" />
    

       <category android:name="digital.dispatch.mobilebooker.(my app name)" />
    

    它在 4.0 + 设备上工作的原因是因为我只做了前两个而不是 3)。 由于 4.0+ 设备不关心接收器的类别,因此它起作用了。 但是,当我在 2.3.3 设备上进行测试时,类别实际上很重要,导致它没有收到任何响应。

    希望这对遇到相同情况的其他人有所帮助。

    【讨论】:

    • 感谢您提交自己的解决方案。我遇到了同样的问题!
    • 我的问题属于类别。
    猜你喜欢
    • 1970-01-01
    • 2016-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-10
    相关资源
    最近更新 更多