Google Cloud Messaging (gcm) Downstream Message Delay
I have downloaded and setup the Android gcm-client and gcm-demo-server (http server) from http://code.google.com/p/gcm/ . I have managed to receive downstream messages in my Androi
Solution 1:
I think that the problem is in the android gcm-client demo that are retaining the message, not in the gcm-server. In GcmIntentService.java file of gcm-client demo, it can be seen that the function protected void onHandleIntent(Intent intent) have the following code:
[...]
// If it's a regular GCM message, do some work.
} elseif (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
// This loop represents the service doing some work.for (int i = 0; i < 5; i++) {
Log.i(TAG, "Working... " + (i + 1)
+ "/5 @ " + SystemClock.elapsedRealtime());
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
}
[...]
This code sleeps android application 5 seconds every iteration (total 25 seconds) before deliver a notification message. You can delete this code due to is an example and you can insert into else if statement some work before show notification.
I have implemented a xmpp server and I receive the notification in <5 seconds, without this working code, of course.
Hope this help and sorry for my bad English.
Post a Comment for "Google Cloud Messaging (gcm) Downstream Message Delay"