简体   繁体   中英

How to reRequest permission for showing notifications in Firebase Cloud Messaging?

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?

See:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM