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

回答

0

我問亞歷克斯·拉塞爾這個問題上Twitter和事實證明,傳統的通知API,我用我的應用程序當前未在Chrome的任何移動版本的支持。看起來我必須使用Google的官方推送通知API,尤其是對於android用戶。

相關問題