如何使用Parse-Server发送Ionic推送通知?

时间:2019-11-01 09:23:42

标签: parse-server

我想从我的离子应用程序向应用程序发送推送通知,现在我编写了解析云代码和普通打字稿,但两者均无法正常工作,实际上是要求向所有设备以及特定设备发送推送通知,请在下面查看我的代码帮我

我的云代码

Parse.Cloud.define("send", (request) => {

    enter code here

    return Parse.Push.send({
        channels: ["News"],
        data: {
            title: "Hello from the Cloud Code",
            alert: "Back4App rocks!",
        }
    }, { useMasterKey: true });
});

打字稿代码 调用云代码

Parse.Cloud.run('send').then(function (ratings) { debugger console.log("updated"); // result should be 'Update object successfully' }).catch((error) => { console.log(error) console.log("fail") });

1 个答案:

答案 0 :(得分:0)

您应该添加查询参数。这样,推送也知道哪个用户发送推送。

您不需要频道的查询参数。您的安装有通道吗?

随时在JS SDK上打开问题。