0

I have one single Gmail account signed up for C2DM.

What I would like is that my app, thanks to this account (after having requested registration IDs and auth tokens for each device), could be able to provide messages to all the devices in which the app is installed.

I want to know if is it possible to use the C2DM in this way..

Thanks a lot

(for any details, just ask me.. )

ps I made the c2dm work on the emulator, but of course I cannot try what written before because I would need several phones..

psk
  • 121
  • 1
  • 12
  • your question could use some clarification. when you say you want your app to be able to send notifications to all devices registered to your c2dm account, are you saying that the android app itself will be pushing notifications to other installations of the same app on other devices? – hankystyles Feb 06 '12 at 16:46
  • Exactly! The android app of course will just notify the users who have installed the app that a new content is available. – psk Feb 06 '12 at 17:06
  • Why are you wanting to originate your c2dm notifications from devices? that kind of thing should be done from a backend component somewhere that's aggregating all the registration ids and determining which ones need notifications etc. – hankystyles Feb 06 '12 at 17:27
  • Exactly, I previously detect (SELECT) the interested devices, and then I notify them that a news (in my case) is available on the 3rd part server. I need the c2dm to be the users (phones) updated with the news I want them to read – psk Feb 06 '12 at 17:33

3 Answers3

0

C2DM has been deprecated. GCM has replaced it, and it allows you to send messages to 1000 devices with one HTTP POST.

C2DM->GCM Migration Guide: http://developer.android.com/guide/google/gcm/c2dm.html

Mark Phillip
  • 1,453
  • 17
  • 22
0

If I understood your issue correctly, the answer is: you can't.

You will have to send one http request, to google servers, for each device you want to reach.

There's no way to broadcast a message to all the users who have registered to your service.

It' frustrating because in my case I send a newsletter for all my users, so opening a connection to millions of users is expensive.

To solve the scalability issue I have created a simple appengine map-reduce task that loops through all the user registrations and create the http connection to the google services, it's the fastest you can go because it dynamically instantiate new servers for your delivery needs.

Rafael Sanches
  • 1,823
  • 21
  • 28
  • Well it's not exactly what I meant, but thanks for replying! I read that it was not possible to broadcast messages, but my problem is before this: I want to know if with just one single role email I can push messagge to several (100s, 1000s) devices (but it seems to me that you are have millions of users, isn't it? ). For example, is the quota "TOO_MANY_REGISTRATIONS" not involved in all this mess? It seems that it prevents to one user to register more than 100 times to c2dm.. Ps how did you solve the ACCOUNT_MISSING problem? Do you ask users to make a new Google account? Thanks – psk Feb 06 '12 at 18:44
  • The way I have implemented I do a registration only once a day per user. The registration of a user is saved in my server and not in the phone. I find that with this way 80% of my messages to users actually arrive to the phones. For the ACCOUNT_MISSING problem, my application doesn't requires C2DM as primary way of functioning, so I ignore that issue. – Rafael Sanches Feb 07 '12 at 22:02
  • What protocol are you using? My app is actually a newsletter too.. Thanks! – psk Feb 07 '12 at 23:43
  • I have an app called "Recipe Search". There's a stackoverflow-like feature, where users make questions about a recipe. Whenever a user reply to that question I send a C2DM notification to all the users listening to that thread. This is just an example, but C2DM is used extensively through the app. – Rafael Sanches Feb 21 '12 at 14:06
0

Going off your question and comments, it sounds like you're just wondering if you can send c2dm notifications to an indeterminate number of devices using only one sender id.

That is exactly the way c2dm is supposed to work. You create one sender id to use on your backend servers, and that sender id is used in your app to register for c2dm notifications. Your backend then gathers all registrations ids and uses your one sender id to push notifications interested parties.

hankystyles
  • 511
  • 2
  • 8
  • Yes, that's why I choosed the c2dm. But I would like to know if there's a limit in the number of devices to which I can push messages with just one rule email (I know there's the limit of the 200,000 messages per day). Are you sure there's no limit? Thanks for answering! – psk Feb 06 '12 at 17:59
  • @psk Yeah, the limit you're alluding to is the quota and that's the only limit I know of on the sender id's side. The TOO_MANY_REGISTRATIONS error you mentioned in your comment is for when the signed in account on the phone has registered for c2dm on too many different apps simultaneously. – hankystyles Feb 06 '12 at 18:03
  • Ok so you say: the TOO_MANY_REGISTRATIONS quota is referred to the account on the phone, NOT the role email. On the contrary, it seems that there's no limit for the role email. Ok, thanks a lot man! – psk Feb 06 '12 at 18:11