We have moved to a new Sailfish OS Forum. Please start new discussions there.
3

How to find out if the phone is in idle state?

asked 2014-08-03 13:40:43 +0200

vertoe gravatar image

I'm writing an app that reads out web APIs every 5 minutes.

Obviously I dont want to do this as long as the phone is in idle state.

How can I check this for my app?

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
1

answered 2014-08-04 17:52:32 +0200

tace gravatar image

In qt app you can check Qt.application.active flag. I catch the signal of change of this flag like this:

import QtQuick 2.0
import Sailfish.Silica 1.0

ApplicationWindow
{

    onApplicationActiveChanged: {
        if (!Qt.application.active) {
            // App not active, stop doing stuff
        }
        else {
            // App is active again, keep on doing stuff
        }
    }

}
edit flag offensive delete publish link more

Comments

Ok that's what I did basicly. Thought that was not enough.

vertoe ( 2014-08-07 09:13:44 +0200 )edit
Login/Signup to Answer

Question tools

Follow
1 follower

Stats

Asked: 2014-08-03 13:40:43 +0200

Seen: 423 times

Last updated: Aug 04 '14