我正在开发Xamarin。表单应用程序现在,我有一些麻烦配置推送通知。我遵循了https://azure.microsoft.com/en-us/documentation/articles/partner-xamarin-mobile-services-xamarin-forms-get-started-push/上的文档,但这只教你如何用推送通知响应请求。
如何在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 });
}
});
}
});
}
推送通知很棘手,因为它们需要不同的平台处理,即使是在表单上。本文通过。net后端完成了整个过程,但它应该能回答你的问题。
http://www.xamarinhelp.com/push-notifications/发送给不同类型的用户,方法是让他们注册到不同的标签,然后只发送给这些标签。标签就是我们所说的组