Send notification to all registered devices

I am trying to add a push notification using Google Cloud Messaging to my Android app. I don’t need anything, I just want to notify all users about the application when certain events occur.

I do not need to notify individual users, I always want to send a notification to each user. This is an internal application with a very limited number of users; it is not publicly distributed.

Now, as far as I understand the documentation, I need a registration identifier for each notification I want to send. I really do not want to track them, because I do not need to identify individual devices.

  • Can I transfer only to all devices without using registration identifiers?
  • If not, how can I get the registration IDs of all registered devices? Do I have to track them manually (out of touch with GCM)?
+5
source share
3 answers

Can I transfer only to all devices without using registration identifiers?

No, sorry, not at the moment.

If not, how can I get the registration IDs of all registered devices? Do I have to track them manually (out of GCM communication)?

Yes, you must track them manually (for example, if the application sends you a registration ID through a web service).

+7
source

You can subscribe to the topic and send a notification from the server

Customer:

 private void subscribeTopics(String token) throws IOException {
    GcmPubSub pubSub = GcmPubSub.getInstance(this);   
    pubSub.subscribe(token, "/topics/global", null);    
 }

Server:

   {"to": "/topics/global","notification":{"message":"testmessage"}}
+2
source

Because you interact with a small number of devices, you may need to use a service that handles server-side complexity, rather than making efforts to implement it. For example, AirBop is a GCM service that is free for up to 1000 devices.

+1
source

All Articles