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

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

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

Related

Is "Upstream Google Cloud Messaging and User Notifications Sign-up" compulsory?

Is signup for "Upstream Google Cloud Messaging and User Notifications Sign-up" at link "https://services.google.com/fb/forms/gcm/" compulsory to get notification from server app to device?
I have created sample app and sending the sample notification from server. i m getting "OK" response along with message_id, i assume that means my message has been accepted by GCm bit the message is not getting delivered to registered Device? I read somewhere with GCM, registration to the link above is required. I tried that too but i didnt get any response back from google. am i missing anything?
Harshil.
Yes, it is compulsory. When sending a message through GCM, you need to specify a SENDER_ID which is given to you when you create a Project inside, and for this, you have to sign up. So even if you got an OK response, I doubt you specified a correct SENDER_ID so this message probably got discarded.
Maybe this might help:
How to send location of the device on server when needed
As of June 2014, sign-up is no longer required for GCM upstream user notifications (among other features).
There's a post on the Android Developer Blog with more info. Specifically:
At Google I/O we announced the general availability of several GCM
capabilities, including the GCM Cloud Connection Server, User
Notifications, and a new API called Delivery Receipt. This post
highlights the new features and how you can use them in your apps. You
can watch these and other GCM announcements at our I/O
presentation.

GCM Message Delivery Confirmation

I am implementing push notifications with Google Cloud Messaging. I am simply testing with their demo applicaitons on official site.
All is working well.
But, has anyone idea of how to gurantee the delivery of message, in anyway?
Or can we invoke server to let know once the message are delivered in device, and will it be reliable approach?
Take a look at the answer on Android GCM delivery monitoring.
"They don't guarantee delivery but they try for a max of 4 weeks to deliver the message depending on the duration you set in the message you send to Google's GCM servers and if you wish to let Google keep the data for eventual delivery of msg to the device in case the device was offline when the message was to be delivered."
Google has added support so that you can receive delivery receipts from Cloud Connection Server (CCS):
You can use upstream messaging to get delivery receipts (sent from CCS to your 3rd party app server) when a device confirms that it received a message sent by CCS.
To enable this feature, the message your 3rd-party app server sends to CCS must include a field called "delivery_receipt_requested". When this field is set to true, CCS sends a delivery receipt when a device confirms that it received a particular message.
https://developers.google.com/cloud-messaging/ccs#receipts

How to catch C2DM notice coming to the phone?

Is it possible for android enabled phone to intercept all C2DM notifications? If so, which way should dig.
Few days back the announcement came that C2DM will be officially deprecated.
At that time C2DM stopped accepting new users and quota requests.
C2DM has been replaced by Google Cloud Messaging for Android (GCM). The C2DM service will continue to be maintained in the short term, but developers must use GCM for new development.
So in near feature we may need to move existing C2DM applications to GCM to take advantage of GCM features.
No, it's not possible to intercept C2DM or GCM messages. The system won't deliver them to your interceptor. They are not delivered via an unsecured Broadcast Intent.

how to set valid time period for android c2dm message?

I would like to implement a feature that only delivers messages to devices at specific periods. After the valid time, messages would be abandoned. Can anyone suggest me how to do this?
C2DM itself doesn't have such a facility so you have two choices:
Your server app only sends messages during certain times
or
Your Android app receives the C2DM messages all the time, but during certain times you ignore/handle as appropriate.
Google just released a new version of c2dm called "Google Cloud Messaging (GCM)" at I/O 2012. With GCM its possible to define a timeout for your messages.
GCM ttl section: http://developer.android.com/guide/google/gcm/adv.html#ttl
You can find my answer to a similiar question here:
https://stackoverflow.com/a/9709944/789738

C2DM limitation?

As of 5/2011 the google documentation for c2dm says this:
"Google limits the number of messages a sender sends in aggregate, and the number of messages a sender sends to a specific device"
What is the specific limitation? If my server sends 10 messages a day to 10,000 devices will Google shut my app down?
When you signup C2DM here, you're asked to fill in a estimated "Estimated total number of messages per day" and "Estimated peak queries per second (QPS)".
According the C2DM quotas page, the currently default limit is approximately 200,000 messages per day.
If your requirement exceeds this limit, you should make sure using C2DM correctly, and submit the request quotas at the bottom link of the quotas page.
The specific limitation is derived per account and is modifiable upon (reasonable) request. For example, I have c2dm account which is "restricted" to "just" 100,000 c2dm messages per day.
If you worry about message count limitation, you should switch to GCM anyways.
There is only a limit of messages saved before collapsing, which is 100.
C2DM is deprecated and has been replaced by Google Cloud Messaging for Android (GCM).
Google's statement:
Important: C2DM has been officially deprecated as of June 26, 2012.
This means that C2DM has stopped accepting new users and quota requests.
No new features will be added to C2DM. However, apps using C2DM will continue to work.
Existing C2DM developers are encouraged to migrate to the new version of C2DM,
called Google Cloud Messaging for Android (GCM).
See the C2DM-to-GCM Migration document for more information.
Developers must use GCM for new development.
There is a demo app tutorial for GCM and also for migration from C2DM.

Categories

Resources