ServiceWorker showNotification() fails on Chrome for Android

310 Views Asked by At

I have two devices running Chrome 64.0.3282.137, a Samsung S7 Edge and a Nexus 7. On the nexus, when I run

function showNotice() {
  navigator.serviceWorker.ready
  .then(function(reg) {
    reg.showNotification("Shiny");
  });
 }

I get a notification. On the S7, I don't (even after clearing out and reloading the service worker, etc.). This also works on Desktop, of course.

The S7 is on Android 7, the Nexus on Android 6, but as far as I can tell, this should be totally dependent on the Chrome version.

So there are a few layers to what I'd like to know. First of all, is this my fault? Secondly, if not me, then I'm worried that I couldn't have predicted this. caniuse.com indicates Chrome 64 for Android doesn't support the Notification API (only the Push API). So is there some other way of knowing what is available reliably without having to test every permutation of device and browser?

Lastly, if there is a way to do non-push notifications on all devices running Chrome 64, I haven't been able to find it. How can I do this?

0

There are 0 best solutions below