Hello everyone,
I am the developer of BridgeCalc, a bridge scoring system currently used by approximately 150 bridge clubs in several countries.
In many clubs, Android tablets are used at each bridge table to enter scores and communicate with a central server via TCP sockets.
I would like to display the battery level of each connected tablet on the server screen, so that the tournament director can easily identify tablets that need recharging.
The server-side implementation is already working perfectly. My only remaining problem is retrieving the actual battery percentage from within my Android LiveCode application.
I am using LiveCode 9.5.1 Community Edition.
So far, I have tried several approaches:
Using a LiveCode Builder library with Java FFI and Android's BatteryManager API. The library compiles and installs successfully, but calling the battery function causes the Android application to hang.
Reading /sys/class/power_supply/battery/capacity directly, without obtaining a valid battery level.
Investigating the JavaScript navigator.getBattery() API, but I have not been able to validate this approach on my Android tablet.
I have also investigated Paul McClernan's Android Battery Library and the earlier forum discussions on this subject.
I do not need any sophisticated battery monitoring, voltage, temperature or charging information. I simply need an integer between 0 and 100 representing the current battery percentage.
Has anyone successfully implemented this functionality with LiveCode 9.5.1 or a similar version on Android?
A working LCB source file, a small sample stack, or even a compiled test APK would be extremely helpful.
I would prefer a solution compatible with LiveCode 9.5.1 Community Edition, without requiring the installation of a separate Android application on every tablet.
Many thanks in advance for your help!
Guy LOUIS
BridgeCalc developer
Belgium
Getting the Android battery level with LiveCode 9.5.1
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller
Re: Getting the Android battery level with LiveCode 9.5.1
Yipes.
Good luck with this, and please let me know how it works out.
I have connected Macs to the real world using LC and a separate standalone USB interface device for years. Always interested in others doing the same sort of thing.
Craig
Good luck with this, and please let me know how it works out.
I have connected Macs to the real world using LC and a separate standalone USB interface device for years. Always interested in others doing the same sort of thing.
Craig
