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用户。

相关问题