Sub Process_Globals
Dim EvenementPhone As PhoneEvents
End Sub
.
.
Sub Activity_Create(FirstTime As Boolean)
EvenementPhone.Initialize("EvenementPhone")
End Sub
.
.
Sub EvenementPhone_BatteryChanged(Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
Msgbox("Battery level " & Level & " %", "")
End Sub
The Phone library is part of the B4A so you dont need to download it.
You must check it in the Tab Libs in the lower right corner in the IDE.
Have a look at the Beginner's Guide chapters 4.3.4 and 13.7
Sub Process_Globals
Dim EvenementPhone As PhoneEvents
End Sub
.
.
Sub Activity_Create(FirstTime As Boolean)
EvenementPhone.Initialize("EvenementPhone")
End Sub
.
.
Sub EvenementPhone_BatteryChanged(Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
Msgbox("Battery level " & Level & " %", "")
End Sub
Unfortunately, i am not experienced enough to make it with B4A. The Intent that has to be sent to show the screen is: ACTION_POWER_USAGE_SUMMARY
B4X:
Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
ResolveInfo resolveInfo = getPackageManager().resolveActivity(powerUsageIntent, 0);
// check that the Battery app exists on this device
if(resolveInfo != null){
startActivity(powerUsageIntent);
}
This java source this the trick but I really can't help how to do it in B4A.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.