Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate low battery in Android devices

Tags:

android

Can anyone tell me how can I simulate low battery in my rooted device?

I gone through this question but did not find much information on this.

like image 458
AndroDev Avatar asked Apr 30 '13 08:04

AndroDev


2 Answers

With the Android Emulator's Extended Controls, it's now possible to set the battery level with a GUI slider called "Charge Level."

To access this, start the emulator. Then click the "..." at the bottom of the settings panel (which hovers to the right of the emulator).

enter image description here

This opens the Extended Controls panel which contains a "Battery" menu item:

enter image description here

The Charge Level slider goes from 0 to 100%. You can also simulate failed/overheated/etc physical battery, and being off the charger by adjusting the other drop down controls.

like image 135
albert c braun Avatar answered Nov 05 '22 15:11

albert c braun


Use the following commands

To simulate the device being unplugged:

adb shell dumpsys battery unplug

To test how the device behaves under low power conditions:

adb shell settings put global low_power 1

Once you have finished your testing, you can undo your manual device settings with this command:

adb shell dumpsys battery reset
like image 7
Gulzar Bhat Avatar answered Nov 05 '22 13:11

Gulzar Bhat