direc85 / harbour-batterybuddy

Battery level alert for Sailfish OS
GNU General Public License v3.0
7 stars 8 forks source link

QTimer is inconsistent, when screen is locked #36

Closed direc85 closed 3 years ago

direc85 commented 3 years ago

The daemon uses QTimer to trigger re-reading the battery, charger et. al. files. This works like a clock (ha) when the device is in use. When the screen is locked - and the device in a low power state - the intervals can be delayed / skipped altogether. This needs to be fixed.

nephros commented 3 years ago

This seems to be the API of choice in this case, according to https://forum.sailfishos.org/t/qml-timers-longer-than-10-minutes/

https://sailfishos.org/develop/docs/nemo-qml-plugins-keepalive/qml-nemo-keepalive-backgroundjob.html/

But, it's of course QML, not Qt.

direc85 commented 3 years ago

I found this thread over at TJC: https://together.jolla.com/question/175209/sudo-make-me-a-sandwich/

I'm currently experimenting with keepalive-tool, because that is the laziest possible solution. If it doesn't blow up battery consumption, I just might go with it... (Most likely it's not Jolla Store viable approach, but hey, I'm using a root service, so... :grin:)

direc85 commented 3 years ago

Well, the solution was studying https://git.sailfishos.org/mer-core/nemo-keepalive/ and switching from QTimer to BackgroundActivity.

Fixed in 5627c5f, released in 08b577f.