I have the same issue here, you find any solution? Works fine on 3G but suddenly stop work on wifi after few minutes.. Thanks.
Work arounds:
The GCM heartbeat interval (15 m) is not freely configurable on
the phones and can be done on rooted phones, so this is not an option to
pursue.
Another way to solve this is to change the TCP time-out on the
routers to a value greater than the GCM heartbeat, but, not
all (SOHO) routers allow that and you cannot ask clients to configure their
routers or buy new routers. Also, when using WIFI hotspots or other public free
or paid WIFI routers there is no way to demand any changes to the routers.
Hence, although the above would be solutions in individual cases, they are no option to a general solution.
Solutions:
A more general "solution", however not one that we would
prefer, would be to send keepalive GCM messages from our server to the GCM
servers and to the phones in every let’s say 4:59 min (assuming that 5 minutes is used by most routers as default TCP time-out setting).
Although we could pursue this solution, we feel that there should be a
more structural and less demanding one, and hopefully Google can suggest or make available such.
A better solution would for instance be to send keepalive
messages initiated from the device. How to do this? By using some GTALK api to
send empty keep alive messages in every 4:59 m:s.
In other words:Is there a way to send a
"ping" message on the GCM connection? Is there maybe an API, or can it become available, such
that we can have access to the GCM connection, probably indirectly (like a GTALK
message)?