如何避免拖延Android的GCM消息/更改心跳消息、Android、GCM

由网友(南城旧少年)分享简介:我一直在阅读关于一个GCM的问题,影响到一些人的很多帖子。看来,在一些设备/路由器/运营商的通知,遭受延误。我已经经历过这个问题,我的路由器。消息传来了很多延误WIFI,但瞬间来了,当我禁用WIFI和连接到移动网I've been reading many posts regarding a GCM issue th...

我一直在阅读关于一个GCM的问题,影响到一些人的很多帖子。看来,在一些设备/路由器/运营商的通知,遭受延误。我已经经历过这个问题,我的路由器。消息传来了很多延误WIFI,但瞬间来了,当我禁用WIFI和连接到移动网

I've been reading many posts regarding a GCM issue that affects some people. It seems that in some devices/routers/carriers the notifications suffer delays. I've experienced this issue with my router: messages came with a lot of delay on WIFI but came instantly when I disabled WIFI and connected to the mobile net.

似乎有一种变通方法,可以从Android应用程序来完成。喜欢的东西越来越多,保持GCM连接活着左右。心跳

It seems there is a workaround that can be done from the Android app. Something like increasing the heartbeat that keeps GCM connection alive, or so.

任何人都可以告诉我们,我们应该怎样做,以避免延误?我们怎样才能保持从Android应用程序与GCM的连接?一个code例子(和在何处以及如何使用它)将是非常有益的。

Can anyone tell us what should we do to avoid the delay? How can we keep the connection with GCM from an Android app? A code example (and where and how to use it) would be really helpful.

这个帖子说明问题。它说,我们可以继续使用ping从GCM服务器(这是免费的)每两分钟连接活着。我们怎样才能做到这一点?

This post explains the problem. It says that "we could keep the connection alive with a ping every two minutes from the GCM server (which is free)". How can we do that?

多谢

下面的应用程序似乎做的伎俩。令人惊奇的是,第一个不需要任何许可,第二个因特网连接,第三个是只为根电话:

The following apps seem to do the trick. Surprisingly, the first one doesn't need any permission, the second one internet connection and the third one is only for rooted phones:

https://play.google.com/store/apps/details?id=at.pansy.droid.gcmWifiFix

https://play.google.com/store/apps/details?id=com.elotro.pushheartbeat

https://play.google.com/store/apps/details?id=com.andqlimax.pushfixer

推荐答案

我会把这个作为第一个答案评论,但我没有足够的声誉。

I would put this as a comment in the first answer but I don't have enough reputation.

我有一个类似的问题,我解决了它调用我的web服务之前,执行下面的code。

I had a similar issue and I solved it executing the code below before calling my webservice.

context.sendBroadcast(new Intent("com.google.android.intent.action.GTALK_HEARTBEAT"));
context.sendBroadcast(new Intent("com.google.android.intent.action.MCS_HEARTBEAT"));

希望它可以帮助你!

Hope it help you!

阅读全文

相关推荐

最新文章