ฉันมีบริการมือถือใน Azure และแอปพลิเคชัน Android ฉันต้องการส่งการแจ้งเตือนแบบพุชบนอุปกรณ์ของผู้ใช้ที่ลงทะเบียนด้วยตนเอง ฉันประสบความสำเร็จในการส่งการแจ้งเตือนผ่าน gcm แต่มันกำลังเผยแพร่การแจ้งเตือนบนอุปกรณ์ทั้งหมด โปรดช่วยฉันในเรื่องนี้
สำหรับการส่งการแจ้งเตือน ฉันได้ปรับแต่งการแทรกแบบสอบถามใน Azure แต่กำลังเผยแพร่การแจ้งเตือน ฉันไม่รู้ว่าจะส่งมันในอุปกรณ์เฉพาะได้อย่างไร
ข้อความค้นหาของฉันคือ-
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();
}
});
}