Delphi recognizes the battery level of an Android device

You may want to know the battery level.
On Android, the battery manager broadcasts intent information about the battery.
To find out the battery level, get the battery level and battery level and calculate the percentage.
The code is based on the Android developer training article “Monitoring battery power and charging status“.
Sample code
Put buttons and list boxes on the form
Just press a button to detect power
Write the detected% value into the list box
Describe the process. (Confirmed through 10.2 Tokyo, Nexus 5 and Android 5.1.1)
//Determine the current state of charge (get battery state intent)
//BatteryManager.EXTRA_LEVEL string//Realistic level // Realistic string scale of BatteryManager.EXTRA_SCALE
//Calculated state of charge%