Simulating Battery Levels and Temperature on Android (No Root)

13 min read Step‑by‑step guide to simulate battery charge and temperature on Android devices without rooting, using Developer Options and ADB commands. October 07, 2026 13:00 How to Simulate Battery Levels and Temperature on Android for Testing (No Root)

When you develop or test apps that react to low‑battery warnings, power‑saving modes, or temperature throttling, you often need a reliable way to reproduce those conditions without waiting for the device to actually drain. Android provides a hidden set of commands that let you simulate battery level, health, and temperature directly from a computer. This tutorial walks you through the entire process – from enabling the required developer settings to verifying that the simulated values are being used by the system.

Before you start

  • Charge your device to at least 50 %. The simulation will overwrite the real values, but a healthy baseline reduces the risk of the system entering an unexpected power‑off state.
  • Install Android Platform‑Tools (adb) on your PC or Mac.
  • Use a USB cable that supports data transfer, not just charging.
  • Make sure the device is unlocked and you can accept the USB debugging prompt.

Step 1 – Enable Developer Options and USB Debugging

  1. Open Settings on the Android device.
  2. Navigate to About phone (or About device on some OEM skins).
  3. Tap Build number repeatedly – usually 7 times – until you see a toast that says “You are now a developer!”.
  4. Return to the main Settings screen; a new entry Developer options will appear, often under System or at the bottom of the list.
  5. Enter Developer options and toggle USB debugging on. Confirm the prompt that appears.

Why this matters: USB debugging opens a secure channel between your PC and the device, allowing adb to issue system‑level commands. Without it, the simulation commands will be rejected.

Step 2 – Verify ADB Connection

  1. Open a terminal (Command Prompt, PowerShell, or Terminal.app) on your computer.
  2. Run adb devices. You should see a line with your device’s serial number followed by device.
    adb devices
    List of devices attached
    1234567890ABCDEF    device
  3. If the device shows as unauthorized, unlock the phone and accept the “Allow USB debugging?” dialog.

Tip: If no devices appear, try reconnecting the USB cable or installing the appropriate USB driver (Windows) or enabling adb permissions (macOS/Linux).

Step 3 – Understand the Battery Service Interface

Android’s battery information is exposed through the BatteryManager service. The adb shell dumpsys battery command can both read and write simulated values. The relevant fields are:

  • level – Battery charge percentage (0‑100).
  • temperature – Measured in tenths of a degree Celsius (e.g., 250 = 25.0 °C).
  • status – Charging state (1=unknown, 2=charging, 3=discharging, 4=not charging, 5=full).
  • health – Battery health (1=unknown, 2=good, 3=overheat, 4=dead, 5=over voltage, 6>under voltage, 7=cold, 8=capacity loss).

When you issue a set command, the system replaces the real sensor values with the ones you provide until you reset the service.

Step 4 – Simulate a Low‑Battery Condition

  1. Enter the following command to set the battery level to 10 % and mark it as discharging:
    adb shell dumpsys battery set level 10
  2. Optionally, force the status to discharging so the UI shows the battery icon without a charging bolt:
    adb shell dumpsys battery set status 3
  3. Confirm the change by running:
    adb shell dumpsys battery
    You should see something like:
    Current Battery Service state:
      AC powered: false
      USB powered: false
      Wireless powered: false
      Max charging current: 0
      Max charging voltage: 0
      Charge counter: 0
      status: 3
      health: 2
      present: true
      level: 10
      scale: 100
      voltage: 3800
      temperature: 300

What to expect: Most Android UI elements (low‑battery warning, adaptive battery throttling, etc.) will now behave as if the device truly has 10 % charge.

Step 5 – Simulate Over‑Heat Temperature

  1. Set a high temperature, for example 45 °C (450 in tenths):
    adb shell dumpsys battery set temperature 450
  2. Optionally, change the health flag to overheat (value 3) to trigger thermal throttling dialogs:
    adb shell dumpsys battery set health 3
  3. Verify with adb shell dumpsys battery as before. Look for the new temperature and health values.

Why this matters: Some apps, especially games and video‑players, lower their performance when the system reports an over‑heat condition. Testing under these simulated values helps you verify that your app handles thermal events gracefully.

Step 6 – Combine Level and Temperature for Edge Cases

Real‑world scenarios often involve multiple constraints. For example, a device might be at 15 % battery and simultaneously overheating. To simulate this:

adb shell dumpsys battery set level 15
adb shell dumpsys battery set temperature 460
adb shell dumpsys battery set health 3
adb shell dumpsys battery set status 3

After issuing the four commands, run adb shell dumpsys battery to confirm all fields are set correctly.

Step 7 – Reset the Battery Service to Real Values

  1. When you are finished testing, restore the original sensor data with:
    adb shell dumpsys battery reset
  2. Optionally, you can reboot the device to guarantee a clean state:
    adb reboot

Important: Forgetting to reset can leave the system thinking it is still low on power, which may cause unexpected shutdowns or reduced performance.

Troubleshooting

Command not recognized or “Permission denied”

  • Make sure you are running the terminal with administrative privileges (especially on Windows).
  • Check that USB debugging is still enabled. Some OEM skins automatically disable it after a reboot.
  • On Android 12+ devices, the dumpsys battery set command may be restricted for security reasons. In that case, you can use the adb shell am broadcast workaround described below.

Device reverts to real values after a few minutes

Some manufacturers (e.g., Samsung, Xiaomi) run a background service that periodically refreshes the battery status from the hardware sensor, overwriting the simulated values. To keep the simulation active:

  1. Run the set commands in a loop. Create a simple batch or shell script:
    # Windows batch example
    :loop
    adb shell dumpsys battery set level 10
    adb shell dumpsys battery set temperature 300
    timeout /t 30 >nul
    goto loop
  2. Alternatively, use the adb shell settings put global battery_estimate_charging_time -1 trick to silence the auto‑refresh (works on Android 10‑11).

System UI does not show the low‑battery warning

  • On newer Android versions, the low‑battery warning is tied to a critical battery level threshold (usually 5 %). Set the level below that threshold (e.g., 4) to trigger the dialog.
  • Some OEM skins hide the warning entirely when the device is in “Battery saver” mode. Disable Battery saver before testing.

Alternative: Using ADB Broadcast for Limited Devices

If the dumpsys battery set command is blocked, you can still influence the system by broadcasting an intent that mimics a battery change event. This method does not change the underlying BatteryManager values, but many apps listen for the broadcast and react accordingly.

adb shell am broadcast -a android.intent.action.BATTERY_CHANGED \
  --ei level 10 \
  --ei scale 100 \
  --ei status 3 \
  --ei temperature 300 \
  --ei health 2

Use this approach when you only need to test your own app’s BroadcastReceiver for ACTION_BATTERY_CHANGED. System‑wide UI changes (like the low‑battery icon) will not be affected.

Best Practices & Safety Notes

  • Do not leave the device in a simulated low‑battery state for extended periods. The OS may throttle CPU and network, making the device feel sluggish for everyday use.
  • When simulating extreme temperatures, remember that the actual hardware is still operating at its real temperature. The simulation only influences software decisions; it does not protect the device from real overheating.
  • Never use these commands on a production device that other users rely on without resetting the service first. A forgotten simulation can cause unexpected shutdowns.

Real‑World Example: Testing an App’s Power‑Saving Logic

Suppose you are developing a fitness tracker that stops GPS updates when the battery falls below 20 % to preserve charge. Using the steps above, you can:

  1. Set the battery level to 19 %.
  2. Launch the app and observe whether GPS stops.
  3. Increase the level to 21 % and verify that GPS resumes.

This quick feedback loop replaces the hours‑long process of actually draining the battery.

Summary

By enabling Developer Options, connecting via ADB, and using the dumpsys battery set command (or the broadcast fallback), you can reliably simulate any battery charge level, temperature, health, and charging status on an Android device without rooting. The method is fast, reversible, and works across most Android versions, making it an essential tool for developers, QA engineers, and power‑conscious users who need to see how their device behaves under extreme conditions.

User Comments (0)

Add Comment
We'll never share your email with anyone else.