Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Drain battery quickly on purpose

I am nearly finished with my app and last functionality to be made is to call specific action when battery level reaches below specific level.

So for test purposes I am wondering - how can I drain battery?

P.S - Using AVD wont work since my app is using Google Play services so I am testing app on my phone.

like image 504
arleitiss Avatar asked Jul 24 '14 18:07

arleitiss


People also ask

Why is my battery draining so fast for no reason?

A lot of things can cause your battery to drain quickly. If you have your screen brightness turned up, for example, or if you're out of range of Wi-Fi or cellular, your battery might drain quicker than normal. It might even die fast if your battery health has deteriorated over time.


Video Answer


2 Answers

For fastest drain turn on at once all battery drainers:

  • Acquire a Wake lock with Full screen brightness (No. 1 battery drainer)
  • Vibration
  • GPS with zero time polling intervals
  • Turn on WiFi and continuously issue http requests
  • Turn on Bluetooth and continuously issue scan commands

And, since you're a smart guy, you will probably use this app instead of hand-coding all of the above.

like image 195
Gilad Haimov Avatar answered Nov 19 '22 11:11

Gilad Haimov


There is an AVD target that contains Play Services (Google APIs target). avd

Edit: you should also be able to use Genymotion from what I've read. It's also much faster than the stock emulator, but if your app uses any native code it may not work.

like image 29
vmagro Avatar answered Nov 19 '22 12:11

vmagro