hajkmap / Hajk

A modern, full-featured OpenLayers based map viewer and editor
MIT License
122 stars 45 forks source link

Mobile user - "Always on" feature #1029

Open JakubPelka opened 2 years ago

JakubPelka commented 2 years ago

Problem: Now if you are doing some work fieldwork mobile is usually turning off the screen by default. So while it is cold, raining or you have dirty hands it is not so great to unlock screen every few seconds / minutes etc.

Need: Make it possible to activate override in mobile that (by the switch) will make it possible to make function "Screen always on" active.

Solution: I know it is doable in some apps - like while navigating with GMaps it will not turn itself off after every 30sec. But how is it done - have no idea.

jesade-vbg commented 2 years ago

After a quick investigation: 1. Probably possible in Chrome on Android using the wakelock api. iOS Safari does not seem to have implemented this (yet). Reference: https://caniuse.com/wake-lock

2. Someone has solved the issue in Safari iOS with a hack... playing a hidden inline video that forces the screen to stay awake... https://github.com/richtr/NoSleep.js

3. Another approach would be to provide a native Hajk wrapper-app for both Android and iOS to be able to use system specific functionality.

jesade-vbg commented 7 months ago

Update: Wake lock is now implemented in Safari, but it does not work in PWA (bug) which isnt good. Still broken in iOS 17.3. https://bugs.webkit.org/show_bug.cgi?id=254545

jacobwod commented 7 months ago

Good investigation @jesade-vbg. Weird that it's enabled for a website but stops working once user adds this to the Home Screen as a PWA. I would have more understanding for this if it was the other way around…

jesade-vbg commented 3 months ago

Update: Wake lock api is now availiable (May 2024) in the latest Chrome+Firefox on android etc. Still not working in PWA in iOS. https://caniuse.com/wake-lock

jacobwod commented 3 months ago

Perhaps worth implementing anyway? I haven't really heard users complain about the screen turning off when it shouldn't, but I can imagine that if someone uses Hajk for navigational purposes it can be annoying.