使用azure移动服务的android设备特定推送通知
我在azure中有一个移动服务和一个android应用程序。我想在自己注册的用户设备上发送推送通知。我成功地通过gcm发送通知,但它正在所有设备上广播通知。请在这方面帮助我 为了发送通知,我在azure中定制了插入查询,但它正在广播通知。我不知道如何用特定的设备发送 我的插入查询是-使用azure移动服务的android设备特定推送通知,android,azure,azure-mobile-services,Android,Azure,Azure Mobile Services,我在azure中有一个移动服务和一个android应用程序。我想在自己注册的用户设备上发送推送通知。我成功地通过gcm发送通知,但它正在所有设备上广播通知。请在这方面帮助我 为了发送通知,我在azure中定制了插入查询,但它正在广播通知。我不知道如何用特定的设备发送 我的插入查询是- function insert(item, user, request) { var payload = '{"data":{"message" : "Hello from Mobile Service
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();
}
});
}
调用push.gcm.send的第一个参数为null。这会告诉推送引擎推送到已注册到您的服务以进行GCM推送的任何设备。您可以通过传入要推送到的特定设备的注册ID或查看通知中心如何使用标记来更改此设置。您是否可以编辑问题以显示用于执行推送通知的代码?是的。我试过了。我的通知错误代码有错误。现在工作得很有魅力。