Search code examples
androidandroid-c2dm

Android C2DM : Duplicate message to the same device and App


I'm wondering if anyone has faced this issue with Google C2DM? This is the scenario I am faced with:

  1. User installs the app and registers with C2DM server for a registration key.
  2. User uninstalls the app.
  3. User reinstalls the app (and registers with C2DM server for new registration key).

Now I send message from my server to the user's phone and they get a duplicate message.

Could anyone shed any insight into wether this is expected behaviour or how I can fix it? Thanks,


Solution

  • Not sure if this is the best approach, but there's a relevant thread over at the android-c2dm group, where the poster offers one technique:

    I am sending registration id in the message, so I can check it against the stored registration id on the device.

    If it's not the same, discard it and notify the service that registration Id is no longer in use

    Downside is sending registration Id takes up some space in already limited message size. But works perfectly in my case since my original message is no more than a few chars long.