GCM停留在寄存器2.3.3姜饼设备上 [英] GCM stuck on register on 2.3.3 Gingerbread device
问题描述
由于某些原因,使用GCMRegistrar.register(这一点,SENDER_ID);适用于4.0 +设备。
然而,它停留在下面的消息未经谷歌获得了GCM通知。
For some reason, using "GCMRegistrar.register(this, SENDER_ID);" works on 4.0 + devices. However, it stuck at the following message without getting anymore GCM notification from Google.
注册应用(我的包),发件人(我的API#)
1)清单,并因为它的工作4.2.1接收器应该是正确的。
1) manifest and receiver should be correct since it's working on 4.2.1.
2)我有谷歌玩,与谷歌帐户2.3.3设备上的链接
2) I have google play and linked with google account on 2.3.3 device
我已经寻找好几天,找不到答案。
任何人都知道什么是错的,或有同样的问题?
I have searched for several day and couldn't find an answer. Anyone know what's wrong or have the same issue?
感谢
推荐答案
我发现这只是因为我没有正确设置接收器的范畴。
I found out it's just because I didn't set the receiver's category correctly.
自从我把我所有的源$ C $ C库中的项目,并与每个应用程序引用它,我需要在清单重新命名3不同的地方。
Since I was putting all my source code in a library project and referencing it with each individual application, I need to rename 3 different places in the manifest.
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设备上进行测试,类别实际上就和导致它没有收到任何回复。
The reason why it worked in 4.0 + device is because I only did the first two but not 3). Since 4.0+ device doesn't care about receiver's category, it worked. However, when I am testing on 2.3.3 device, the category actually matters and causing it not receiving any response.
希望这将帮助任何其它遇到同样的情况。
Hope this will help any other that encounter the same situation.
这篇关于GCM停留在寄存器2.3.3姜饼设备上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!