How to send a GCM message with Java Appengine

To send regular GCM I can do

Sender sender = new Sender(apiKey);
Message message = new Message.Builder()
    .addData("message", "this is the message")
    .addData("other-parameter", "some value")
    .build();
Result result = sender.send(message, registrationId, numOfRetries);

Will anyone show how I can send a topic message from Appengine (Java)

+4
source share
1 answer

You can use this version of the Java GCM library . Soon it will be merged into a master branch. It supports messaging on topics. To post a topic message, simply set the topic as the To field. For example: / themes / mytopic

Sender sender = new Sender(apiKey);
sender.send(message, topic);
+1
source

Source: https://habr.com/ru/post/1612994/


All Articles