简体   繁体   中英

Is that possible to send a message with Name of sender in android GCM.?

I have developed an android application which can send and receive push messages using Android GCM. Suppose if I am sending a push message to "xyz" device from "aaa" device I am getting a push messages succesfully, but what I need is that parallelly I wanted to display the name of the device which has sent a message with respect to the body of GCM message.

Ex:

xyz: hi test

Please suggest me on this. Thanks in advance

Regards Anand

You can send anything in the GCM message. If you want to send the name of the sender alongwith the message, you first need to get the name of the user and save it in a variable. Then add that name with the message in the GCM message. To differentiate the name and message part of the push notification, you can encode the GCM message in a JSON format and then send it to the other user. Then you can decode the message using JSON decoder.

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