问题
Here is my scenario.
When network is down, GCM client locally stores device-to-cloud messages (upstream), in a local queue (it's length seems to be 20, although never stated).
When this queue is full, messages are locally discarded and the intent contains the message type MESSAGE_TYPE_SEND_ERROR
+ extras about which messageId was deleted, and error=TooManyMessages
.
Using the TTL'd version of gcm.send, allows to force upstreams to be always discarded (when network is down) instead of queued (message type MESSAGE_TYPE_SEND_ERROR
+ extras about which messageId was deleted, and error=SERVICE_NOT_AVAILABLE
), which is not what i want.
So far, so good. Problem is, on JB (4.1.2 & 4.2.2) & ICS (4.0.4), queued messages while network is down, are not sent when network is up again. A reboot forces them to be sent. And worse, once the queue is full, messages can't be sent anymore, even when network is up. Here again a reboot is necessary. Looks like a "flush" is missing somewhere.
This works perfectly on KK 4.4.2
On every test devices, google play service APK is up to date.
Can anyone confirm this behavior in JB & ICS, and maybe other version? Is there a workaround? Thanks.
回答1:
Latest upgrade from Google solved the issue.
I don't precisely know which component upgrade did it, but the issue is gone on all previously tested versions.
来源:https://stackoverflow.com/questions/22418823/locally-stored-upstreams-when-network-is-down-are-not-sent-on-network-up-on-jb