Android Question battery remaining

Darren Llewellyn

Member
Licensed User
Longtime User
Does anyone know if it's possible to access the amout of battery time remaining? I have seen it in the settings and I wondered if it was accessable.

Thanks in advance
 

Darren Llewellyn

Member
Licensed User
Longtime User
I can't seem to see an entry for that there present, Scale, Voltage Temperature, State, Health, invalid charger, Plugged and Icon but nothing else is there some other method to retrieve this information?
 
Upvote 0

DKCERT

Member
Licensed User
Longtime User
Semi code:

B4X:
Sub Process_Globals
  Dim PE As PhoneEvents

  Dim BatteryLevel As Int
  Dim BatteryCharging As Boolean
End Sub

Sub PE_BatteryChanged(Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
    BatteryLevel = Level
    BatteryCharging = Plugged
    'Log("Level: " & Level & "%, Scale: " & Scale & ", Plugged: " & Plugged)
End Sub
 
Upvote 0

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
Thats how I am getting the value of level as a % of battery but I want to get the amount of time you have left.

I don't see how that would be possible since the amount of time left depends on how the device is being used. Assuming that power is being used at a constant rate (which is probably NOT a valid assumption), you could check how long it takes the power level to drop "x" number of % and extrapolate time remaining from that.
 
Upvote 0
Top