Is there a way to get battery remaining percentage value on a mobile device (Android and Linux OSs) with Qt5/QML? Or only via system API? Thanks!
Asked
Active
Viewed 394 times
0
-
Probably took me less time to google that than it took you to type the question ... does [this](https://falsinsoft.blogspot.com/2017/06/qml-get-android-battery-level-and-status.html) help? – tink Aug 05 '21 at 23:45
-
@tink I asked for cross-platform Qt-framework C++ or QML solution. Previously Qt had solutions for this in QML. And what about Linux? – Aleksey Kontsevich Aug 06 '21 at 00:23
-
What is previous Qt and what was a solution? – folibis Aug 08 '21 at 09:56
-
@folibis not sure what version it was, seems some 4.x: https://doc-snapshots.qt.io/qt-mobility/qml-batteryinfo.html – Aleksey Kontsevich Aug 09 '21 at 10:06
-
1I guess that the only way is to implement it by yourself. You can create a c++ extension for QML and so use it in your code. There is several ways, [libacpi](https://evileg.com/en/post/241/) if you on some Linux device or [read](https://stackoverflow.com/questions/30776050/reading-battery-status-on-linux-ubuntu-using-qt) it from a device, using [Android service](https://falsinsoft.blogspot.com/2017/06/qml-get-android-battery-level-and-status.html) etc. – folibis Aug 09 '21 at 11:27
-
@folibis thanks much! Could You add above info and links to the answer, please? – Aleksey Kontsevich Aug 10 '21 at 16:03