【发布时间】:2014-05-28 04:07:32
【问题描述】:
xamarian Android 项目并不总是收到从 push.gcm.send() 触发的推送消息。广播接收者第一次只调用 onregister(),而不调用 onmessage()。 我的 php 服务器脚本与 https://android.googleapis.com 配合得很好,它调用了广播接收器的 onmessage()。同样具有 azure 移动服务的 Native android 项目使用 push sharp 客户端的行为相同,当 push.gcm.send() 在 azure 服务器中执行时,它不会调用 onmessage()。让我知道我做错了什么,我使用了完美的应用程序密钥,服务器密钥,项目编号,........下面是日志详细信息。我收到状态码 201。
日志条目详细信息:
信息
测试推送通知发送:APA91bELUme4gM35eHBH4dmxo7AVBkmVu6Gsown_8zrROb5SsKzHn7MgpypBirmmDDuyPlr8hRjBDRX2lBc_j9voAPYv2RotXiVTHMaXFRRADu0xNfrPk-G-bCkfsCO7Uv-OnPMW8bgmTHIX8u8exKpGxfSrFZvN8dEDAoC5iw {isSuccessful:真, 状态码:201, 身体: '', 标题: {'传输编码':'分块', '内容类型':'应用程序/xml;字符集=utf-8', 服务器:'Microsoft-HTTPAPI/2.0', date: '2014 年 5 月 27 日星期二 19:40:00 GMT' }, md5: 未定义 }
输入脚本:
function insert(item, user, request) {
request.execute({
success: function() {
// Write to the response and then send the notification in the background
request.respond();
push.gcm.send(item.channel, item.text, {
success: function(response) {
console.log('Push notification sent: ', response);
}, error: function(error) {
console.log('Error sending push notification: ', error);
}
});
}
});
}
【问题讨论】:
标签: android azure google-cloud-messaging azure-mobile-services