Battery Info

The library to access various information about the battery of the device.

Permissions

Permissions=DeviceInfo

Dependency libraries

  • dbus-1

Features:

  • Battery charge level.
  • Battery charger status.
  • Listen charger status.

Example

var states: MutableMap<ULong, Boolean> = mutableMapOf()

class AuroraBatteryInfo {

    fun getLevel(): Int {
        return BatteryInfo.getLevel()
    }

    fun listen(): ULong {
        return BatteryInfo.listenCharger { id, value ->
            states.put(id, value)
        }
    }

    fun getStateCharger(id: ULong): Boolean {
        return states[id] ?: false
    }
}