Android的GCM SERVICE_NOT_AVAILABLEAndroid、GCM、SERVICE_NOT_AVAILABLE

2023-09-05 02:36:47 作者:恨不能相逢

我想设置这个例子: https://$c$c.google.com/p/gcm/source/browse/#git%2Fgcm-client 启动和运行。

I was trying to set this example: https://code.google.com/p/gcm/source/browse/#git%2Fgcm-client up and running.

该GoogleAPI项目已经成功创建,根据指南:http://developer.android.com/google/gcm/gs.html

The GoogleAPI project has been successfully created, according to the guide: http://developer.android.com/google/gcm/gs.html

不过,我有以下问题:在某些设备上,我得到SERVICE_NOT_AVAILABLE不管。

However, I have the following problem: on some devices I get SERVICE_NOT_AVAILABLE no matter what.

W / System.err的:java.io.IOException异常:SERVICE_NOT_AVAILABLE W / System.err的:在com.google.android.gms.gcm.GoogleCloudMessaging.register(来源不明)

W/System.err: java.io.IOException: SERVICE_NOT_AVAILABLE W/System.err: at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)

一些统计数据:

的Nexus 7,安卓4.2.2:GCM例如完美的作品 的Nexus 4,安卓4.2:GCM例如完美的作品 的Nexus S的Andr​​oid 4.2.2:GCM例如完美的作品 三星Galaxy 3:SERVICE_NOT_AVAILABLE在100%的情况下 三星Galaxy,安卓2.3.6:SERVICE_NOT_AVAILABLE在100%的情况下 在摩托罗拉Xoom,安卓4.1.2:SERVICE_NOT_AVAILABLE在100%的情况下 的HTC Desire HD,Android 2.3的:SERVICE_NOT_AVAILABLE在100%的情况下

这是相同的code,同样的apk文件,不同的谷歌帐户。我试图切换回GCMRegistrar方法和他们的实际工作。所以,问题是:在某种测试新的GCM方法呢?如何使他们在其他设备上工作,而不仅仅是纯谷歌Android设备?

It's the same code, the same apk file, various google accounts. I tried to switch back to GCMRegistrar methods and they actually work. So the question is: are new GCM methods in sort of beta? How to make them work on other devices, not just 'pure' Google Android devices?

更新:其实,我发现这里解决

Update: In fact, I found the solution here

推荐答案

有时发生由于时间SYN与GCM。请看看的时候,如果它是正确的。如果可能的话再重新设置。

Sometimes it happened due to time syn with GCM. Please have a look at the time, if it is correct. If possible then reset.

两件事来检查,如果您使用的是仿真器,那么请确保您有在模拟器上运行谷歌的API。和第二gcm.jar包含在你的项目。

Two more thing to check, if you are using a emulator then please make sure that you have the google api running on the emulator. and second gcm.jar is included on your project.