Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Java gcm-server to send message to topic

I'm using Java gcm-server to send messages to Android client apps, and I would like to send a message to a specific topic as showed here.

My problem is that I only managed to send a message using the Sender class, to a list of registration_ids, and I can't figure out how to use parameter "to": "/topics/myTopic" (I read the source code and it seems it is not implemented).

Any advice?

like image 407
Andrei F Avatar asked Aug 15 '26 13:08

Andrei F


1 Answers

Yes,Right Now... Not Implemented yet,

you need to make a HTTP POST request to :

https://android.googleapis.com/gcm/send

with body

{ "data": { "title": "Test Title", "message": " Your Message" },

"to" : "/topics/global"

}

For more Help - https://github.com/googlesamples/google-services/blob/master/android/gcm/gcmsender/src/main/java/gcm/play/android/samples/com/gcmsender/GcmSender.java

like image 84
Amit Singh Avatar answered Aug 18 '26 03:08

Amit Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!