Android Question Push Service and large user numbers

Nickelgrass

Active Member
Licensed User
Longtime User
Hi,
I have an App with over 1500 users. The thing is now I would like to implement a Push notification. I already made a nice sample with app and php script. All works fine.

But how do I manage such a number of users. How can I determine if one user is not valid any more? I would need to then delete him from the list on the server.
And how would I handle the user ID? Should I simply generate a long random string in the app and hope that there are no doubles?
Or can I somehow give all users the same ID and have the notification be sent to all the users automatically?

Thanks!

Regards
 

DonManfred

Expert
Licensed User
Longtime User
It is google who tell you the id.
You can see in the GCM example that on an REGISTER a request is send to google. You get back the id from google and store the id in your database.
You cannot create your own IDs and you cannot give the same ID to everybody. Each "registration at GCM get his own ID.

If you want to remove the user from your database. Feel free to do so. Best way to remove a user is when he UNREGISTER at GCM.
 
Upvote 0

Nickelgrass

Active Member
Licensed User
Longtime User
Hi,
thanks for the reply.
I am sorry, I used the wrong term. I mean the name of the user, then the Google ID is stored in a list with the names. To send a message I use the name to get the ID.

But the problem remains. What if a user kills his phone out of some reason and the device remains registered but is not actually there any more. With 1500 users that may happen. Then I would send the messages to devices that dont exist anymore. I would like to identify "dead" devices and then remove them from the list.Is it enough to evaluate Googles response to the send request?

Edit: Googles response does not show if the device is still alive. So should I just remove entries that are not updated every x days or hours?
 
Last edited:
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
If you have 1500 users, perhaps you also have static IP address. With this, you can create your own messaging server with RDC.

It is more flexible and you have full control with its system.
 
Upvote 0

Nickelgrass

Active Member
Licensed User
Longtime User
Ok, thanks, I have implemented a deletion after 3 days and the phone sends an update every 24 hours just to be on the safe side.

Is it ok to send all 1500 (or perhaps soon 2000-3000) push notifications in one request to google or should they be split in bunches of 100 or so?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Is it ok to send all 1500 (or perhaps soon 2000-3000) push notifications in one request to google or should they be split in bunches of 100 or so?
The total amount of bytes a request needs is limited.
I have in mind 4k payload or so... But i´m not sure. I just have in mind that i read it somewhere deep in the gcm-documentation...

Edit:
Every message sent in GCM has the following characteristics:
  • It has a payload limit of 4096 bytes.
  • By default, it is stored by GCM for 4 weeks.
But i do rememder also that there is a limit on a request...

Edit2:
Sending Messages
Here is the general sequence of events that occurs when a 3rd-party application server sends a message:

  1. The application server sends a message to GCM servers.
  2. Google enqueues and stores the message in case the device is offline.
  3. When the device is online, Google sends the message to the device.
  4. On the device, the system broadcasts the message to the specified Android application via Intent broadcast with proper permissions, so that only the targeted Android application gets the message. This wakes the Android application up. The Android application does not need to be running beforehand to receive the message.
  5. The Android application processes the message.
The following sections describe the basic requirements for sending messages.

Target
Required. When your app server sends a message in GCM, it must specify a target.

For HTTP you must specify the target as one of:

  • registration_ids: For sending to 1 or more devices (up to 1000). When you send a message to multiple registration IDs, that is called a multicast message.
  • notification_key: For sending to multiple devices owned by a single user.

For CCS (XMPP):
 
Last edited:
Upvote 0
Top