I am a beginner in android, trying to use GCM services, I am able to register devices and receive messages from server through GCM.
The problem comes when the server stops sending the messages for a while.
Just for testing purposes i am running this loop on the server, to send messages to the device, every 5 secs.
for (;;) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Content content = createContent();//the data to send to the client
PostGcm.post(apikey, content);
}
The client receives it without delay, No Problem!
But when I increase the sleep time to minutes, the message delivery becomes erratic. However on the server, I get the success message from the GCM, which makes me think there is a problem on GCM side
I have looked up on similar question on StackOverflow but didn't get an answer/solution for it. Temporary solution is to restart the phone/network connection.
- Google Cloud Messaging - messages either received instantly or with long delay
- GCM stop working after some time
- GCM msg delivery times are WILDLY erratic
This is my message
{
{
"time_to_live": 60,
"delay_while_idle": false,
"data": {
"title": "Title",
"message": "Message"
},
"registration_ids":["REGISTRATION ID"]
}