【问题标题】:Parse push notifications send data解析推送通知发送数据
【发布时间】:2018-07-27 22:52:05
【问题描述】:

我正在尝试通过 Parse 推送通知在我的有效负载中发送数据。

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');
});

在我的有效负载中,我存储了一个 customData 字段。如何在自定义广播接收器的 onReceive() 中访问此字段;

【问题讨论】:

    标签: android push-notification parse-server


    【解决方案1】:

    如果你的结果是一个 Bundle,你可能应该在你的 Android 应用中使用它

    /**
     * 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")
        }
     }
    

    【讨论】:

    • 被覆盖的函数是onReceive(Context context, Intent intent)。我如何访问捆绑包?
    • 你可以获取一个intent的bundle,尝试获取将成为数据的Bundle
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多