2
我的Android版Chrome瀏覽器兼容標準版和開發者版(51)。儘管通知API在其他瀏覽器(Chrome桌面上的Firefox & + Android上的Firefox)上完美工作,但它在移動Chrome瀏覽器上不幸失敗。瀏覽器要求獲取通知事件的權限,但不會顯示它。正如上面提到的那樣,Firefox在同一個手機上沒有問題,以及Chrome的桌面版本。這裏是我的代碼:適用於Android的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