【问题标题】:Chrome for Android - Notifications don't appear适用于 Android 的 Chrome - 不显示通知
【发布时间】: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


    【解决方案1】:

    我在 Twitter 上向 Alex Russel 询问了这个问题,结果发现,我在我的应用程序中使用的旧版通知 API 目前不受任何移动版 chrome 的支持。看起来我必须使用谷歌的官方推送通知 API,特别是对于 android 用户。

    【讨论】:

    • 您能提供更多详细信息吗? Google's official push notifications API 是什么意思?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多