Why do Android C2DM push messages not always arrive?

后端 未结 2 1012
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 07:05

I\'ve built a functioning C2DM app and generally it works very well, and the push messages arrive fast. However I find that fairly regularly when I first start the app or br

2条回答
  •  不知归路
    2021-01-03 07:18

    I realised I made a schoolboy error. I was re-registering with C2DM every time the app started. That process sometimes takes quite a few seconds, and during that time the app will not receive push messages sent to the old registration ID. This explains why push messages were particularly likely to fail to be received immediately after starting the app.

    The solution was to ensure the registration ID is only requested if the app does not already have one. Push messages are now working much more reliably.

提交回复
热议问题