How to set a timeout/expiration on a C2DM message?

家住魔仙堡 提交于 2019-12-02 20:27:38

问题


Is there a TTL or expiration or some sort of timeout feature for C2DM messages?

I would like the C2DM message to be received within 10 minutes by the device, any longer (ie: if their phone is off) and the C2DM message should not be received by the device.

I could probably implement something in the device to ignore any C2DM messages if they are old, but I'm not sure how accurate that would be with different device time settings.

A TTL flag on the C2DM message sent to google would be perfect, but not sure if they support this.

Cheers! Dave


回答1:


C2DM does not have such a feature. Please have a look here:

how to set valid time period for android c2dm message?

Update:

Google just released a new version of c2dm called "Google Cloud Messaging (GCM)". With GCM it is possible to use a timeout for your messages:

I really recommend the Google I/O 2012 "Google Cloud Messaging for Android" session available here: http://www.youtube.com/watch?v=YoaP6hcDctM

Additionally you can read through the GCM ttl section: http://developer.android.com/guide/google/gcm/adv.html#ttl



来源:https://stackoverflow.com/questions/8473918/how-to-set-a-timeout-expiration-on-a-c2dm-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!