简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM