本文介绍了如何使用Parse.com Cloudcode发送推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Parse.com上发送带有Cloudcode的推送通知。
I want to send a Push Notification with Cloudcode on Parse.com.
推送通知应发送给订阅特定频道并触发服务的所有Android设备。
The push notification should be sent to all android devices that are subscribed to a specific channel and trigger a service.
推荐答案
您不需要查询来发送推送到频道。只需致电并添加频道数组到数据对象。
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发送推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!