我正在开发Xamarin.Forms应用程序,并且在配置推送通知时遇到了一些问题。我遵循https://azure.microsoft.com/en-us/documentation/articles/partner-xamarin-mobile-services-xamarin-forms-get-started-push/上的文档,但这只会教你如何通过推送通知来响应请求。推送通知渠道Azure JS后端
如何创建推送通知并将其发送给Xamarin.Forms中的用户?如何设置不同的推送渠道,以便一次性通知特定用户组?
正因为如此,这里是与推送通知响应我的JavaScript后端代码:
function insert(item, user, request) {
// Execute the request and send notifications.
request.execute({
success: function() {
// Create a template-based payload.
var payload = '{ "message" : "New item added: ' + item.text + '" }';
// Write the default response and send a notification
// to all platforms.
push.send(null, payload, {
success: function(pushResponse){
console.log("Sent push:", pushResponse);
// Send the default response.
request.respond();
},
error: function (pushResponse) {
console.log("Error Sending push:", pushResponse);
// Send the an error response.
request.respond(500, { error: pushResponse });
}
});
}
});
}
这只是一个建议。值得看看parse.com,它有一个推送通知服务和所有平台的非常简单的API。 –