使用内容可用的解析服务器云代码发送推送通知不起作用

Sending Push Notifications with Parse Server Cloud Code using content-available not working

我正在尝试使用 Parse Server 推送适配器从 云代码 发送推送通知。通知已成功发送,但问题是如何使用 'content-available' 标志。我不确定我是否以正确的方式使用标志,因为当通知到达时应用程序没有按应有的方式唤醒。

这是代码:

Parse.Push.send({
   where: query,
    data: {
      alert: 'One more test 1',
      badge: 1,
      sound: 'default',
      content_available: 1
   }

}, { useMasterKey: true });

同样,通知到达但 'content-available' 标志不起作用。有人使用这种方法发送推送通知吗?我应该把 'content-available' 放在哪里?

谢谢大家!

好的,我知道了!这比我想象的要容易。

正确的代码是:

Parse.Push.send({
    where: query,
    data: {
        alert: 'One more test 1',
        badge: 1,
        sound: 'default',
        objectId: user.id,
        'content-available': 1

    }

}, { useMasterKey: true });

'content-available' 标志应使用破折号(“-”)和引号之间的整个短语分隔。

就是这样!希望这可以帮助像我一样挣扎的人。

代码很棒!