Reputation: 339
I have a PWA which implements push notifications. Everything works correctly when the user accepts the initial permissions request as prompted by the browser. Here is the scenario I'm having trouble with.
User is on Android, running the app through the PWA icon in standalone mode (no browser chrome is shown).
User accepts permission request for notifications. Notifications are received as expected.
User goes to app settings and turns off the "Allow Notification" toggle. As expected, notifications are not received.
User goes to app settings and turns on the "Allow Notification" toggle. Notifications are not received and the browser permission has changed from "granted" to "denied".
Since I cannot re-prompt the browser to ask for permission when it's at a "denied" status, how would the user turn back on the notification permission in the browser? Is there a manual way to do this within Chrome? I can reset the permissions to "default" by uninstalling and re-installing the app but that is not a practical solution.
The PWA runs in standalone mode so there are no menus or icons related to the browser available to the user. When I open the site in Chrome directly (not using the PWA icon), I can select the settings icon from the URL bar and see that Notifications are blocked despite the fact that they were turned back on in the app settings. It seams that the app setting updates the browser setting when turned off but not when turned on.
How would a user get the notification permission turned back on in the browser?
*** Solved as of Android 13 ***
On Android 13, changing of the Allow Notifications toggle in the app settings now flows through to the PWA once the PWA is closed/reopened. Not sure when this changed but it's a workable solution now.
Upvotes: 6
Views: 3627
Reputation: 303
I encountered the same problem, so far the only solution I had found is to switch from PWA to Chrome, open the website associated with the application and enable notifications through the settings button in the address bar, to the left of the URL. The site and the application on Android are the one thing, so notifications are also enabled in the application.
Upvotes: 0
Reputation: 131
On android device, you can press and hold the PWA Icon then a popup menu will appear, then click on "Site Settings" then click Notifications and then switch the "show notifiaction" on.
on clicking the "Site Settings" actually it will take you to chrome App info, as if you go to "Settings" in your android device -> "Apps" -> "Chrome" -> "Notifications"-> "Notifications categories-> then you will find your site there and you can enable or disable notification (that was a manual way to do it).
Upvotes: 2