How to find out if the phone is in idle state?
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?
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?
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
}
}
}
Asked: 2014-08-03 13:40:43 +0300
Seen: 439 times
Last updated: Aug 04 '14