The following code reads the status of a notebook battery:
B4X:
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
obj.New1(False)
obj.CreateNew("System.Windows.Forms.SystemInformation" & obj.System_Windows_Forms)
obj.Value = obj.GetProperty("PowerStatus")
Msgbox(FindPowerLineStatus, FindBatteryLifePercent)
End Sub
Sub FindBatteryLifePercent
Return obj.GetProperty("BatteryLifePercent")
End Sub
Sub FindPowerLineStatus
Return obj.GetProperty("PowerLineStatus") 'returns Offline or Online
End Sub
Thanks Andrew, I only had v0.9 zip of that library which had no .chm or .cs files.
In the former file, two descriptions seem inconsistent on backup vs. main; is there an error? ...
BackupBatteryLifeTime : Int32 : Returns a value indicating the number of seconds of main battery, if present, life remaining, or –1 if remaining seconds are unknown.
BackupBatteryFullLifeTime : Int32 : Returns the number of seconds of backup battery, if present, life when at full charge, or –1 if full battery lifetime is unknown.