I'm developing a Xamarin.Forms app right now and am having some trouble configuring push notifications. I have followed the docs on https://azure.microsoft.com/en-us/documentation/articles/partner-xamarin-mobile-services-xamarin-forms-get-started-push/, but this only teaches you how to respond to a request with a push notification.
How can I create a push notification and send it to a user in Xamarin.Forms? How can I set up different push channels so that specific groups of users are notified at a single time?
As it is, here is my Javascript backend code for responding with push notifications:
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 });
}
});
}
});
}