问题
Is there a way I can get the information whether the c2dm message was sent to a device or still in queue somewhere on App Engine side? The device won't get the messages if it's on some WiFi access point (random behavior).
I want to implement time limit to the notification messages. If the time is up, the messages make no sense anymore and should never be delivered.
回答1:
You shouldn't be sending information, however small, directly to your users through C2DM. C2DM is designed to be used as a way to alert your device that there is new information on the server. Your client should then connect with the server to download the relevant information. If you follow this design pattern, then between your client-side and server-side code, I'm sure you can easily figure out if a message is stale or not.
回答2:
Please note that Glendon has the best solution. Another way would be to include the time sent with the message. Then calculate how far in the past that message was sent when received on the phone, taking no action if it is too old.
来源:https://stackoverflow.com/questions/6726581/android-c2dm-message-received-confirmation-at-app-engine-side