Skip to main content


 

Qt background tasks


Does anyone know how to start scheduled background tasks in Qt? Is there some timer class or some OS specific thing like the JobScheduler in Android?
http://doc.qt.io/qt-5/qtimer.html
http://doc.qt.io/qt-5/qml-qtqml-timer.html

Those are just timers, not "background task". When the timer fires it triggers the event handlers, where you do the job.
You application must be running for timers to do their job.

If you want to have some code running at specific intervals also when you application is not running, that's a OS specific thing.

For example, this is the timer that refresh notification in Friendly, all in QML.

Thank you! Android kills all apps regularly and you have to create services for background tasks due to battery saving. I wonder what the mechanism on Plasma Mobile etc. is and how battery is working...

I don't know. On Sailfish is simple: apps in store can't have background timers.
Apps outside store can register a user timer service with systemd...

So no background sync for social media with apps from store? Hmmm...