You can use the BatteryManager library to check the status of the battery with EXTRA_LEVEL :
int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL,0);
Unfortunately, you can get the remaining time only with the approximation, because some applications can consume more power.
Greetings
user4891187
source share