最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to reRequest permission for showing notifications in Firebase Cloud Messaging? - Stack Overflow

programmeradmin2浏览0评论

I'm developing the push notifications for web app with Firebase Cloud Messaging.

After the first run I got request notification promt because of this code:

const messaging = firebase.messaging();
    messaging
        .requestPermission()
        ..........

I have granted the permission, but now when I visit this page I didn't ever see the request for permission promt because I already granted the permission while the first run. How can I unsubscribe my device to see permission requests again?

I'm developing the push notifications for web app with Firebase Cloud Messaging.

After the first run I got request notification promt because of this code:

const messaging = firebase.messaging();
    messaging
        .requestPermission()
        ..........

I have granted the permission, but now when I visit this page I didn't ever see the request for permission promt because I already granted the permission while the first run. How can I unsubscribe my device to see permission requests again?

Share Improve this question edited Aug 19, 2019 at 14:15 Frank van Puffelen 601k85 gold badges890 silver badges860 bronze badges asked Aug 19, 2019 at 13:57 DmitryDmitry 834 silver badges11 bronze badges 2
  • 1 In desktop/Android Chrome, at least, you can click the lock next to the URL, go to "Site Settings", and then change the "Notifications" setting. – Michael Bleigh Commented Aug 19, 2019 at 16:02
  • @MichaelBleigh, yes I read about this. I thought it is possible to do it programmatically. Thank you. – Dmitry Commented Aug 20, 2019 at 7:58
Add a ment  | 

1 Answer 1

Reset to default 5

See:

  • https://support.google./chrome/answer/3220216?co=GENIE.Platform%3DDesktop&oco=0&hl=en
  • chrome://settings/content/notifications
  • https://firebase.google./support/release-notes/js#cloud-messaging
  • https://developer.mozilla/ja/docs/Web/API/notification/requestPermission

Deprecated requestPermission(). Use the native browser API Notification.requestPermission() instead.

If firebase version is newer 6.0.4 then you should use Notification.requestPermission().

发布评论

评论列表(0)

  1. 暂无评论