Chrome notification does not appear

Asked

Viewed 42 times

0

Good evening, I’m running a code to present a notification:

if(Notification.permission === 'granted' && !this._active) {
    let n = new Notification(this._activeContact.name,{
       icon : this._activeContact.photo,
       body : data.content
    });

But no notification is coming! What might be going on?

Permission is already positive

*****edited****

the code q asks for permission is this: alias, not working in edge...

checkNotifications(){
    // debugger
    if (typeof Notification === 'function'){
        if (Notification.permission !== 'granted'){
            this.el.alertNotificationPermission.show()
        } else {
            this.el.alertNotificationPermission.hide()
        }

        this.el.alertNotificationPermission.on('click', e=> {
            Notification.requestPermission(permission => {
                if (permission === 'granted') {
                    this.el.alertNotificationPermission.hide()
                    console.info('notificações permitidas!')
                }
            })
        })
    }
}

1 answer

0

Have you tried to make his call using requestPermission?

Notification.requestPermission()
  • yes Ucas, I have a method that is doing this... I will edit the question to show!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.