2

First of all I do not know the difference between "sleep mode" and "standby", so I am most likely using the wrong term in the following problem description:

I build myself a little PWA that tracks my routes with OpenLayers. It works fine so far, but at some point the recording of a track is interrupted. I assume this is due to the automatic sleep mode, which "turns off" Chrome and probably therefore also "navigator.geolocation".

Is there any chance to let my PWA and navigator.geolocation continue doing their work when Android is in sleep mode? And if so, is there any way to activate that setting via the PWA and without going into "Settings -> ... -> ..." (if that is at all an option)?

Thank you!

PS: The gis.stackexchange.com community recommended me to ask this question here.

PPS: A "PWA" ("Progressive Web App"), in short, is nothing else but a web application that looks and behaves like a "real" app. Even though it is run in a browser (in my case I only focus on Chrome), it can be used offline via service workers, the UI does not show the browser's address bar and some things more. By using all the modern browser APIs it is possible to create an app without having to go through the app store (even though a PWA could be registered as an app in the app store, too).

1
  • 1
    AFAIK, a PWA relies on a web browser and is subjected to the same constraints the browser is. Since I don't know about this see if you can ask the user to exempt your app (the browser technically) from battery optimization. Native apps can ask the user this way. I might be wholly wrong on the subject but this is my opinion given my experience with PWAs based on end-user specific interaction with them. – Firelord Mar 4 at 13:09
1

As it turns out, there is a Web API, "Screen Wake Lock API": https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.