Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending push to multiple android devices with a single POST

I've implemented push notifications in my Android app and am trying to build out the server-side to make it more scalable. Looking at the documentation on how to construct the POST to send a push, it seems I need to send a POST for every single user. So if I have 1000 users, I need to send 1000 POSTs, even if the push payload is identical.

Since I'm sending this to Google and they're processing it anyway, I figure it's not unreasonable to hope that I can send a single POST and have Google parse the client tokens and send a push per token. I don't see a way to include multiple tokens in a single POST. So correct me if I'm wrong, but I'll need to continue what I'm doing today, sending a push for every single user...correct?

Thanks in advance.

Google Push documentation

like image 755
Sam Dozor Avatar asked Nov 14 '11 16:11

Sam Dozor


2 Answers

That's correct. Since one of the parameters of the push is the id of the registered device, you can only push to one device at a time.

like image 164
LuxuryMode Avatar answered Nov 18 '22 20:11

LuxuryMode


To anybody still looking at this question - there is now a solution! With the release of Google Cloud Messaging you can now send multicast messages:

http://developer.android.com/guide/google/gcm/gcm.html

like image 32
Sam Dozor Avatar answered Nov 18 '22 19:11

Sam Dozor