如何使用 Parse.com Cloudcode 发送推送通知 [英] How to send Push Notifications with Parse.com Cloudcode
本文介绍了如何使用 Parse.com Cloudcode 发送推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 Parse.com 上使用 Cloudcode 发送推送通知.
I want to send a Push Notification with Cloudcode on Parse.com.
推送通知应该发送到所有订阅特定频道并触发服务的安卓设备.
The push notification should be sent to all android devices that are subscribed to a specific channel and trigger a service.
推荐答案
您不需要查询即可向频道发送推送.只需调用 Parse.Push.send 并添加一个频道数组到数据对象.
You don't need a query to send a push to a channel. Just call Parse.Push.send and add a channel array to the data object.
Parse.Push.send({
channels: [ "channel_name" ],
data: {
alert: "Alert message"
}
}, {
success: function () {
response.success("Push was sent");
},
error: function (error) {
response.error("Could not send push " + error)
}
});
请确保不要在频道名称中使用空格和大写字母.该频道不会添加到后端订阅的频道中.
Be sure to not use spaces and Capital letters in channel names. The channel will not be added to the subscribed channels in the backend.
这篇关于如何使用 Parse.com Cloudcode 发送推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文