I have a mobile service in azure and an android application. I want to send push notification on user device who is registering it self. I got success on sending notifications through gcm but it is broadcasting the notifications on all devices. Please help me in this regard.
for sending notification I have customized insert query in azure but it is broadcasting the notifications. I have no idea how to send it in specific device.
my insert query is-
function insert(item, user, request) {
var payload = '{"data":{"message" : "Hello from Mobile Services!"}}';
request.execute({
success: function() {
// If the insert succeeds, send a notification.
push.gcm.send(null, payload, {
success: function(pushResponse) {
console.log("Sent push:", pushResponse, payload);
request.respond();
},
error: function (pushResponse) {
console.log("Error Sending push:", pushResponse);
request.respond(500, { error: pushResponse });
}
});
},
error: function(err) {
console.log("request.execute error", err)
request.respond();
}
});
}