Some Queries on C2DM in Android
Asked Answered
P

1

9

I am currently working on one android application which has C2DM implementation and I successfully implemented it. But Now I have problem in sending message to multiple devices.

As per my understanding following will be process for it:

  1. Save reg id & authcode in database (Suppose in c2dm table)
  2. Send message with a loop to all the data from c2dm.

But problem is:

every time I start application it ask for reg id & send it to server so if one device register 10 times the above loop will fail 9 times & works one time & this will make very large database which is not useful.

Does anyone know to what will be server side code (I am using PHP) when we want to send message to all device using my application & how I should save reg_id & authcode in database.

Thank You

Pious answered 11/11, 2011 at 6:5 Comment(2)
u can tag ur post with PHP too to get relevant answers..Article
u should know that the token from registering to c2dm server will change overtime. therefore in your server db same device might have lots of different token stored. u can probably do a cron job to delete the older ones.Amphiaster
R
3

My solution has just been to mark records as deleted in my database if Google gives me a response indicating that it's an invalid registration or no longer registered. Then it only fails once for a given registration.

Rus answered 17/11, 2011 at 20:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.