Can i use firebase cloud messaging without notification permission? (Javascript)

后端 未结 2 1531
庸人自扰
庸人自扰 2020-12-02 02:03

Update: Google Bug Report Description

(as suggested by google dev advocate in comments on answer 1, filed a bug report; updating the content here si

2条回答
  •  自闭症患者
    2020-12-02 02:31

    It's to protect the user's preferences about what your app is allowed to do. The way push messaging works on browsers is by using a service worker. Even though you say you don't need a service worker, you are actually making using of it when using Firebase Cloud Messaging in your app.

    Given that, the prompt is necessary because the browser doesn't know what you intend to do with that push message. If the user doesn't trust your app, they should have the right to limit what it can actually do, especially when they're not using your app. Mobile operating systems (iOS, Android) are the same way.

提交回复
热议问题