0

I've been working with de C2DM for sometime and its has been working perfect. Recently I've bumped into a problem that I can't seem to fix and couldn't anything on this forum that might help. The problem is that I have several apps that use C2DM, I've let all apps register with the same sender id which then registers the users token in my database. The problem if a user has two of my apps A & B (same sender id) and launches app A and I send a push notification to users with app B, user who launched app A the last will receive a message which was actually intended for app B.

My question is there a way to use the same sender id for all apps installed on 1 device?

Bami
  • 111
  • 9

1 Answers1

1

No. A C2DM Registration ID is scoped to one app on one device. If a C2DM message is sent to a Registration ID, it will only ever be delivered to one app. you should have used different C2DM accounts from the start, so each app has its own registration ID. Registration IDs are not per device, they are Per App Per Device.

If you cannot reconfigure the registration IDs then you could use a receiver that then sends a broadcast intent, and both your apps could pick it up by responding to that broadcast. I expect you'd need both apps to listen-and-rebroadcast, but it should work. I'd advise you reconfigure your C2DM usage tho, as your current setup is not ideal and I expect the problem will only get worse.

I assume when you say "sender id" you mean registration id.

Ollie C
  • 28,313
  • 34
  • 134
  • 217
  • Thanks Ollie C, Yes i mean registration id ( Google calls it sender id). Well I thought so that there wasn't another way other than assigning each app its own registration id. I haven't deployed the apps yes, was still testing them. This does cause i problem , that I would have to create for each app a google account. The other problem is that each application belongs to a client. In this case the client could provide is account information, but the thing that bothers me is that I will have to prompt the client to provide his password as well. – Bami Mar 29 '12 at 13:49
  • Don't confuse registration ID with sender ID. It's perfectly valid for all of your apps to be using the same sender ID, but as Ollie C said, each registration ID is associated with one app on one device. – gnuf Mar 29 '12 at 16:13