Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Service Worker not running on Chrome for Android?

Currently I'm trying to build a web app using the Samsung Tab A. I thought this device would support Service Workers, cause following Can I Use says Chrome for Android 55 is required to run SW.

The tablet is running Android 6.0.1 (no more updates available) and Chrome 55.0.2, but unfortunately when the code shown below runs, the 'no sw' alert pops up.. The SW works fine in Chrome on desktop (mac OS).

if('serviceWorker' in navigator) {
  navigator.serviceWorker.register('/sw.js').then((registration) => {
    alert('sw');
    console.log('ServiceWorker successful, scope: ', registration.scope);
  }).catch((err) => {
    alert('no sw');
    console.log('ServiceWorker failed: ', err);
  });
}

Am I doing something wrong, or is it not possible to run SW on this kind of tablet? What else is needed if Chrome 55 isn't enough? I think there is some lack of information about this topic since I can't find the answer on this .. :(

Thanks in advance!

EDIT: I'd already enable multiple flags via chrome://flags without any success..

like image 784
ronnyrr Avatar asked Jan 14 '17 12:01

ronnyrr


People also ask

How do I enable service in Google Chrome?

A: From a page on the same origin, go to Developer Tools > Application > Service Workers. You can also use chrome://inspect/#service-workers to find all running service workers.

Can I delete Google service worker?

You can also go to the URL: chrome://serviceworker-internals/ and unregister a serviceworker from there. Save this answer. Show activity on this post. Save this answer.

Can I use service worker without PWA?

Service worker installation happens silently, without requiring user permission, even if the user doesn't install the PWA. The Service Worker API is even available on platforms that do not support PWA installation, such as Safari and Firefox on desktop devices.


1 Answers

I was using ngrok to serve my webapp locally to my tablet. Did forget to use https..

like image 125
ronnyrr Avatar answered Nov 10 '22 20:11

ronnyrr