# App to shutdown TP before 0% battery



## luccyo (Oct 15, 2011)

Hi everyone,

I noticed that my TP doesn't shut down before draining all the battery and i've seen that it could make problem to restart it.
So i made a little app to shutdown automatically when battery % is under 5%.

Since this kind app can be quite dangerous, i've made it a service that you have to activate at start up.

And i give you the app and the source code so you can check that it doesn't intend to harm your tp.

If someone can check and validate the app before anyone install it it will be best.


----------



## nevertells (Oct 29, 2011)

luccyo said:


> Hi everyone,
> 
> I noticed that my TP doesn't shut down before draining all the battery and i've seen that it could make problem to restart it.
> So i made a little app to shutdown automatically when battery % is under 5%.
> ...


Appreciate your effort, but the TouchPad will warn you when your battery level drops below 20% and again when you reach 5%. Once gets a big message on the screen to plug in your charger and an alarm tone. At aroud 3%, the TouchPad will shut down on it's own. It does not drain the battery completely. If one trys to boot a TouchPad that is that low, it will just show a screen with a battery symbol and then turn off. However, when the TouchPad battery gets that low, it has to be plugged into the wall charger anywhere from 30 minutes to 2 hours before it will become responsive again.


----------



## luccyo (Oct 15, 2011)

Thx for the reply but my touchpad DOES drain battery completly without shuting down it's the only reason i dis this app. Why would i make an app witch does something alredy there ? I just share this if anyone has the same porblem.
Pas : i'm running cm 9 alpha 0.6


----------



## Dubi (Jan 19, 2012)

nice job and txs for sharing the code.
will build it tomorow with a greather battery level so dont need to wait to until it gets to 5%, that's too long








My tp never dies, never left the battery ran out, but I do think is a good idea to have the option to send it to sleep at a specif battery level (which must be configurable by the user)
It's always better to have a little bit of juice left to start and charge.


----------



## Dubi (Jan 19, 2012)

Yeap, it works.
Tested on my HD2 (don't have the TP right now) and it does what it suppose to do,
turn the phone off (was not aware of the '-p' reboot parameter







)
The RECEIVE_BOOT_COMPLETED starts the application on the next boot which is good, but you should provide an option to enable/disable it.

As I said, nice concept, keep up developing it.


----------



## luccyo (Oct 15, 2011)

If i provide an option to enable/disable the start on boot it could be dangerous if you disable the start on boot and that your tp is below the min value. It will keep shutting down as you start it. I know the start on boot is quite intrusive be i don't know how to make it better.
ps : Here's the new version with option to chose your own min level.


----------



## donut (Dec 15, 2011)

Question: does it care if touchpad is plugged in or not? Because there seems to be a sort of issue when the touchpad is on the charger but still discharging. Will this app turn the tablet off in this situation?


----------



## Dubi (Jan 19, 2012)

The TP won't shutdown if is receiving charge from the USB socket or Touchstone so this won't help in that situation.


----------



## razzbaronz (Oct 30, 2011)

I use Llama https://play.google.com/store/apps/details?id=com.kebab.Llama, you can set it to shut down at any level you want. It works well whether or not it's charging.


----------

