Search code examples
androidmessageandroid-c2dmduration

How long C2DM message is valid?


I am new to android development,now I am working on C2DM implementation for android device. I have used this below code to get the registrationID for the device.

public void register(View view) {
    Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
    intent.putExtra("app",PendingIntent.getBroadcast(this, 0, new Intent(), 0));
    intent.putExtra("sender", "youruser@gmail.com");
    startService(intent);
}

I am following this tutorial for C2DM implementation.

Now my question is if device is switched off for a longer period of time (for ex. 15 days),so I want to know how long the C2DM message will be valid?

If device is switched on after that and application server has not sent next C2DM message,so will device get that C2DM message?


Solution

  • as per http://www.hightechno.info/2011/08/c2dm-tutorial-send-push-notifications.html

    In this same query, another property is interesting: collapse_key . This key is an identifier that is given to messages of a similar nature. Thus, if the phone is switched off and that several messages with the same identifier C2DM accumulate on the server, only the latter will be sent when the appliance is turned on. It is therefore necessary to carefully select these identifiers. . .

    delay_while_idle
    
    • If included, indicates that the message should not be sent immediately if the device is idle. The server will wait for the device to become active, and then only the last message for each collapse_key value will be sent. Optional.

    as per how to set valid time period for android c2dm message?

    • our 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.

    as this this link for push over looks third pary app

    If your phone is connected to the Internet then it will instantly receive the notification from the Pushover servers. If not, it will remain there for 30 days until you do connect.

    Your notifications are secure, as all transmissions are encrypted.