[SailfishDevel] Preventing auto sleep and detecting sleep mode

Arvid Fahlström Myrman behold at behold.se
Thu Feb 20 18:16:50 UTC 2014

Well, I've at least solved the first problem by implementing a timer similar to 
the one used by ScreenBlank in Sailfish.Media (see 
/usr/lib/qt5/qml/Sailfish/Media/ScreenBlank.qml for reference), and it seems to 
work properly. I wonder though, how are we developers supposed to know about 
these DBus services? Are they documented somewhere? I also suspect that the 
org.nemomobile.dbus import won't be allowed in Harbour, though I assume that 
it should be possible to just ship the module along with my application.

I'm still looking for a way to detect when the screen goes blank, i.e. when 
the device enters sleep mode. Any ideas?


On Monday 17 February 2014 00:52:22 you wrote:
> Hi,
> I have two questions relating to sleep mode:
> First, is it possible for an application to prevent the Jolla from
> automatically entering sleep mode e.g. while on a specific page? An example
> use case would be when using navigation apps while driving, where you need
> the screen to be on at all times, and you don't want to have to use your
> hands to prevent the screen from going black.
> Second, is it possible to detect when the device enters sleep mode? So far
> I've been checking if either ApplicationWindow.applicationActive is true, or
> if Cover.status is either Active, Activating or Deactivating, to see if the
> application is currently "visible", but it seems that sometimes when
> entering sleep mode while an application is active,
> ApplicationWindow.applicationActive will remain true during sleep mode (and
> when unlocking the device I'll be met by the application rather than the
> lock screen).
> Regards,
> Arvid

More information about the Devel mailing list