API Documentation
Documentation for developing SailfishOS applicationsBackgroundJob QML Type
Provides means for waking up from / preventing suspend More...
Import Statement: | import Nemo.KeepAlive 1.2 |
Properties
- enabled : bool
- frequency : enumeration
- maximumWait : int
- minimumWait : int
- running : bool
- triggeredOnEnable : bool
Signals
Methods
Detailed Description
Provides abstraction for scheduling tasks that can wake the system from suspended state and prevent system from suspending while handling the wakeup.
Property Documentation
If changed from false to true, starts the timer.
If changed from true to false, stops the timer / ends suspend prevention.
enabled defaults to false.
Sets the desired wakeup frequency and starts the timer.
Note that wakeups are aligned in system wide manner so that every timer that is scheduled to occur in the same frequency gets triggered simultaneously. Effectively this means that the first wakeup most likely happens earlier then the requested frequency would suggest.
The frequence can be one of:
- BackgroundJob.ThirtySeconds
- BackgroundJob.TwoAndHalfMinutes
- BackgroundJob.FiveMinutes
- BackgroundJob.TenMinutes
- BackgroundJob.FifteenMinutes
- BackgroundJob.ThirtyMinutes
- BackgroundJob.OneHour - the default
- BackgroundJob.TwoHours
- BackgroundJob.FourHours
- BackgroundJob.EightHours
- BackgroundJob.TenHours
- BackgroundJob.TwelveHours
- BackgroundJob.TwentyFourHours
- BackgroundJob.MaximumFrequency
Note that defining wakeup frequency is mutually exclusive with using wakeup range.
See also BackgroundJob::minimumWait and BackgroundJob::maximumWait.
Sets the desired maximum wait delay in seconds and starts the timer.
See also BackgroundJob::minimumWait and BackgroundJob::frequency.
Sets the desired minimum wait delay in seconds and starts the timer.
See also BackgroundJob::maximumWait and BackgroundJob::frequency.
Returns true when the timer has been triggered (and the device is prevented from suspending).
This property serves similar purpose as triggeredOnStart in standard QML Timer objects: Setting triggeredOnEnable to true causes triggering immediately after enabling - which can be useful for example for establishing an initial state.
triggeredOnEnable defaults to false.
Signal Documentation
This signal is emitted when timer wakeup occurs and system is prevented from suspending.
In order to allow suspending again, the application must define onTriggered handler and make sure one of the following actions are taken after handling tasks related to the wakeup:
- set BackgroundJob::enabled property to false - to stop the timer
- call BackgroundJob::finished() method - to schedule the next wake up
Method Documentation
If enabled property is true, switches BackgroundJob to running state and emits BackgroundJob::triggered() signal.