【发布时间】:2016-04-14 16:29:29
【问题描述】:
我对适用于 Android 的标准版和开发版 (51) 的 Chrome 有疑问。虽然通知 api 在其他浏览器上运行良好(桌面上的 Chrome 和 Firefox + Android 上的 Firefox),但不幸的是它在移动 chrome 上失败了。浏览器请求通知事件的权限,但它不显示它。如上所述,同一部手机上的 Firefox 没有问题,桌面版的 Chrome 也是如此。这是我的代码:
handleNotification: function (message) {
if (!Notification) { return; }
if (Notification.permission !== "granted") { Notification.requestPermission(); }
else {
var notification = new Notification(participantsRepository[message.senderID].firstName, {
icon: participantsRepository[message.senderID].photo,
body: message.body,
});
notification.onclick = function () {
this.props.updateViewOnMessengerComponent('threadView');
this.updateCurrentThread(message.thread, true);
}.bind(this);
}
},
有什么解决办法吗?
干杯,Wojtek
【问题讨论】:
标签: javascript google-chrome notifications push-notification android-notifications