简体   繁体   中英

Parse push notifications send data

I am trying to send data in my payload in a Parse push notification.

Parse.Push.send({
   where: pushQuery,      // for sending to a specific channel
   data: payload,
   }, { success: function() {
   console.log("#### PUSH OK");
   }, error: function(error) {
   console.log("#### PUSH ERROR" + error.message);
   }, useMasterKey: true});

   response.success('success');
});

In my payload, I store a customData field. How can i access this field in my onReceive() in my custom broadcast receiver;

You should probably work with this in you Android App if your result is a Bundle

/**
 * Called when message is received.
 * @param from SenderID of the sender.
 * @param data Data bundle containing message data as key/value pairs.
 * For Set of keys use data.keySet().
 */
override fun onMessageReceived(from: String?, data: Bundle?) {
    if (data != null) {
        val message = data.getString("text")
        val title = data.getString("title")
    }
 }

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