Thank you Lorn,

then WakeupWatcher works as expected.

The only problem I now have is that the timer used to monitor the state
wheter the Android service is running or not keeps running forever.
Even if I set the Timer's running property to false when the screen is
closed the timer keeps on running.

Any idea why this happens?

Here is my timer code:

Timer {

        id: alienTimer

        running: WakeupWatcher.isScreenOn();

        interval: 1000;

        repeat: true;

        onTriggered: {

            isAlienRunning = Alien.isRunning();

//            isAlienTimerRunning = WakeupWatcher.isScreenOn();

            alienStatus = isAlienRunning ? "running" : "not running";

            btnStopAlien.enabled = Alien.isAlienInstalled() &&
isAlienRunning && isPasswordSet && !isStop && !isRestart;

            console.debug("alienTimer is " + isAlienTimerRunning);

        }

    }

The WakeupWatcher.isScreenOn returns true if screen is on and false if it's not.

I don't understand why the timer does not stop and start when that
property is changed.

Here is some output from the application:

[D] QWaylandEglIntegration::QWaylandEglIntegration:58 - Using Wayland-EGL

[W] QQmlImportDatabase::importPlugin:1697 - Module 'Sailfish.Silica' does
not contain a module identifier directive - it cannot be protected from
external registrations.

[D] MLocalThemeDaemonClient::MLocalThemeDaemonClient:81 -
MLocalThemeDaemonClient::MLocalThemeDaemonClient(const QString&, QObject*)
Theme: "jolla-ambient"

[D] MLocalThemeDaemonClient::MLocalThemeDaemonClient:112 -
LocalThemeDaemonClient: Looking for assets in
("/usr/share/themes/blanco/meegotouch",
"/usr/share/themes/jolla-ambient/meegotouch")

DeclarativeCoverWindow: I have a default alpha buffer

alienTimer is true

alienTimer is true

alienTimer is true

alienTimer is true

alienTimer is true

alienTimer is true

alienTimer is true

[D] WakeupWatcher::mceDisplayStateChanged:62 - --> currentDisplayState =
"on" , screenOn = true

alienTimer is true

alienTimer is true

alienTimer is true

alienTimer is true

[D] WakeupWatcher::mceDisplayStateChanged:62 - --> currentDisplayState =
"off" , screenOn = false

alienTimer is true

alienTimer is true

alienTimer is true

alienTimer is true





// Peter Pykäläinen


On 29 April 2014 07:00, Peter Pykäläinen <peter.pykalai...@gmail.com> wrote:

> Thank you so much.
> I will give this a try.
>
> // Peter Pykäläinen
> 29.4.2014 6.43 kirjoitti "Lorn Potter" <lorn.pot...@jolla.com>:
>
>
>> On 29 Apr 2014, at 5:09 am, Peter Pykäläinen <peter.pykalai...@gmail.com>
>> wrote:
>>
>> > Hi,
>> >
>> > any idea on how to use QML DeviceInfo on Sailfish?
>> > I have been searching for a solution to get the event when device
>> screen is
>> > locked (onLockStatusChanged), but apparently the imports are not
>> working /
>> > not allowed.
>>
>> DeviceInfo no longer has that functionality in Qt 5.
>>
>> Try something like this:
>>
>> https://github.com/nemomobile/connectionagent/blob/master/connd/wakeupwatcher.cpp
>>
>> https://github.com/nemomobile/connectionagent/blob/master/connd/wakeupwatcher.h
>>
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>>
>
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to