Get the remaining time from your Android phone

Is it possible to get the remaining battery life on an Android phone?

Thank.

+5
source share
2 answers

You can get battery life using the broadcast receiver by registering the receiver for the Intent.ACTION_BATTERY_CHANGED action . My answer is only key, get information from the Android developers website.

onReceive() BroadcastReceiver Intent, (, 50%, 60% ..). , . , .

battery_level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);

, .

+3

( ..), , . , , , .. , , , .

+4

All Articles