What would prevent navigator.setAppBadge() from working on Android PWA?

150 views Asked by At

A PWA I'm working on is no longer showing app badges. It's always been flaky, but somewhere in the last few months it's stopped altogether, although I don't think the related calls have actually changed. I must have done something wrong, but can't find it... https://theatrehub.online

I've so far checked:

  • the PWA successfully installs
  • display is set to "standalone" in the manifest
  • navigator.setAppBadge is indeed supported on the device and browsers I'm testing
  • a service-worker sw.js is present and registers/activates
  • sw.js registers a periodic-sync, which every so often triggers a function to fetch the message-count from our API, which then runs navigator.setAppBadge(msgCount) with the result.
  • Permissions on my Android 13 phone for the PWA set to "Notifications Allowed: Badge, Lock Screen, and Popup"

However, I can't get any badge showing up on the PWA icon on my phone, despite there definitely being a msgCount number returned... I've tried connecting via USB remote DevTools and triggered the API-fetching command manually, and even running navigator.setAppBadge(3) from the PWA's console in either Top or sw.js context, but it still doesn't add the badge. I've tried via the newest Chrome and Edge on 2 different phones now...

What aspect of this setup would be preventing the badge from appearing? Is there a different way I should be calling it (either from the service-worker or elsewhere)? How can I better test it manually?

Thank you! David

0

There are 0 answers