2

I am developing an Ubuntu Phone html 5 application and I want to prevent the screen from dimming and locking the phone if there are no user interaction in the screen. (The application is showing an animation but the screen goes idle and locks it).

I have tried quite a few ways to prevent this as suggested by stackoverflow. Among them: going html5 fullscreen, playing "empty" audio file and so on. But nothing seems to work and I haven’t found anything in the API documentation regarding this.

Has anybody successfully managed to do this or know how to do it?

  • `HTML` is a markup language, I highly doubt you'll find something in the API documentation for this since it's totally out of `HTML`'s scope, the solution might rather be found in some hack along the lines of those you already mentioned. Can't give one unfortunately. – kos Apr 20 '15 at 19:27
  • I was hoping something similar to this had made it into the Ubuntu specific parts: http://w3c.github.io/wake-lock/ Because I thought keeping the screen alive while playing audio, sound or an html5 canvas animation would be a quite common use case for an app... – Gard Honningsø Apr 21 '15 at 13:17

1 Answers1

2

Apps cannot prevent the screen from locking.

The only way to keep the screen from locking, is for the user to go into System Settings and change the screen lock timeout to Never.

dobey
  • 40,344
  • 5
  • 56
  • 98
  • Do you know if that applies to QML apps in Ubuntu also? If I can keep a QML app alive i guess i could go the hybrid route in http://askubuntu.com/questions/266260/can-i-develop-a-hybrid-native-html5-app-for-the-ubuntu-phone?rq=1 – Gard Honningsø Apr 21 '15 at 13:21
  • It applies to any apps running on the phone, whether they are HTML5, QML, C++, C, Python, etc… – dobey Apr 21 '15 at 13:36