4

I am trying to ask user to grant permissions by Notification.requestPermission(), but it seems to work only in desktop browser.

In Android Chrome the prompt does not show up, but if I do alert(Notification.permission) then it alerts denied.

What else can I do?

2
  • you might have blocked notifications in your mobile browser. so denied is coming. change that from chrome content settings Commented May 8, 2018 at 9:54
  • Ok, I found out what it was - it seems I have problem with serviceWorker registration Commented May 8, 2018 at 10:00

2 Answers 2

4

You might have blocked the notifications in your mobile browser unknowingly Activate them again

Go to

Chrome => Settings => Advanced => Site Settings => Notifications and check Ask first 

Allow or block notifications from some sites:

  1. On your Android phone or tablet, open the Chrome app Chrome.
  2. To the right of the address bar, tap More More and then Info Information.
  3. Tap Site Settings and then Notifications.
  4. If you don’t see the setting here, this website can’t send you notifications.
  5. Choose Allow or Ask first.

Here is the reference

Ps: It was an issue with his service worker registration. Anyway this answer can be helpful to any other user.

Sign up to request clarification or add additional context in comments.

5 Comments

Now go to storage and clear site storage and reopen chrome.
Also, I added one reference, Please check that
You can vote my answer so others may not downvote it
@JakubKosior, Updated my answer. With your solution. So that it can be useful to others
Clearing site storage and resetting notification permissions for one specific site was not enough. I hat to completely wipe chromes data and start as if the app was newly installed. Then the prompt is shown.
0

Ok, I found out what it was - it seems I have problem with serviceWorker registration, not with permissions.

Anyways, thank you Sravan

5 Comments

I am facing the exact same problem. Do you recall what the problem with the registration was? Request permission only shows a dialog after my pwa was installed.
Same issue here, in some cases the permission dialog won't show up
Think im having the same issue, Chrome not asking for permissions when PWA is installed
@apc I guess it's a problem with chrome only rather than a problem in our app or service worker registration as I have started facing the same issue from few days only. Recently, Chrome was also updated on Android. And I did no code changes related to service worker or PWA. Maybe we should raise an issue on Google chrome community.
I think your right. Misery loves company at least :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.