7

I am developing Android app using GCM. Currently I am using standard Google libs on client and server sides. If I am testing on two Android devices GCM works fine when both devices switched on regardless if my app is running or not.

However if Device A is switched off and I am sending messages to it from Device B, when Device A switched back on it doesn't receive any messages been sent while it was off line.

On server side (which initiates an actual send) every message to Device A has no collapse_key, time_to_live is set to 2000000 (just in case for testing purposes). Actual send has retries parameter set to 50 (in case GCM itself is unreachable, however this is unlikely).

Do I need to complete the GCM registration procedure on device boot? Currently I do so.

Please note that GCM broadcast receiver and GCMIntentService were set as well as permissions in manifest as described on Google web site.

Any advice will be much appreciated. I really got stuck with this issue.

Wesley Wiser
  • 9,491
  • 4
  • 50
  • 69
user986589
  • 201
  • 2
  • 5

2 Answers2

1

Sorry guys. It was my fault. Shared preferences were not loaded properly, that caused GCMIntentService to operate unproperly. Messages go in fine.

So SOLVED

user986589
  • 201
  • 2
  • 5
0

Do I need to complete the GCM registration procedure on device boot?

No, you don't.

In our project we don't have any problems with receiving messages which was sent while device was switched off or ofline. We don't use any google libraries and done all as described at gcm homepage Also, we don't set any collapse_key and time_to_live for our messages.

By the way, do you process message_type? My be GCM notify you that message was deleted

Henry Pootle
  • 1,196
  • 1
  • 11
  • 30
  • Thank you for your suggestion. Will try to debug message_types. I have a default receiver for message delete. Btw I used the same web page to start with. By google's library I have ment gcm.jar from android-sdk – user986589 Oct 16 '12 at 08:43
  • Well after remove of collapse_key and time_to_live I have done some tests. Now on device boot I have no messages, but as soon as I will send next one from server while device is online, SOME of previous messages deliver. Hmmmm.... – user986589 Oct 16 '12 at 09:06