Take the 2-minute tour ×

Is there an Android API for stop charging even though physically the charging is on?

share|improve this question
I really love this question. Good! And welcome to SO! –  barmaley Jul 11 '11 at 18:24
Very valid question, as it would be nice to prevent charging past 70% to reduce battery aging. However the answer is quite simple: there's no API to achieve this :( –  3c71 Oct 6 '13 at 5:46
stackoverflow.com/questions/15993635/… suggests it is possible on rooted devices? –  Tom Jan 10 at 12:19

6 Answers 6




android.intent.action.BATTERY_CHANGED is a protected intent that can only be sent by the system. Therefore you cannot duplicate or override the functionality.

share|improve this answer
I would prefer to have more detailed answer... Can you justify? –  barmaley Jul 11 '11 at 18:25

You guys are all missing the point - the purpose of limiting charging is to increase battery lifespan by keeping it away from fully charged conditions (and near empty but that's a different issue). If you anticipate needing a full charge then tell it to charge to 100.

If you can't set a charge limit then the battery would rarely be idle and ideally charged when on the charger. It probably requires device level support though.

share|improve this answer
The point of not charging to 100% is to avoid the faster aging when charging past 70% and heat combined. On the other side, draining to 0% has no adverse effect on battery aging and is already well protected as battery can go down to 2800mV without aging and most device limits it to 3200mV. Info taken from (hard-to-find) a battery manufacturer and a user testing drain manually. –  3c71 Oct 6 '13 at 5:32
@3c71, draining a lithium ion battery to 0% (or even to what the manufacturer tells you is "0%") most certainly is bad for the battery's longevity. –  Nate May 23 at 8:10
@Nate, not at all, I've done that on many devices and never lost any capacity, and the reason is very simple: battery deteriorate only when it's charge level goes below 2.8V which is way beyond the 3.2V / 0% set by manufacturer. Other electricians/engineers have also confirmed this with real tests and actual measures. –  3c71 May 24 at 8:35

I dont think there would be such an api. If it does exist it needs to be supported by the device manufacture as its not a pure OS lever feature. The same reason would make it a bad idea to use it as not all devices will support it.

That being said it would be a bad idea to use/implement it , mobile devices are not built to directly run from the power supply and a user will not plug in the cable if he/she did not want to actually charge the device.

share|improve this answer
The reason I want to do it is that i want to develop an app that will stop charging when the battery is full and start charging again when it say 95%. it would save a lot of electricity because instead of charging all night, the charger will work only the time it needs to work. think green... –  daniel Jul 11 '11 at 19:28
@daniel I believe the phone does that already (possibly not 95% but some percentage < 100). Read this: androidcentral.com/bump-charging-what-it-and-how-do-it –  Glendon Trullinger Jul 11 '11 at 19:35
@Glendon Trullinger you have a valid point , guess only developers face it :-) , on the side note keeping the screen off/locked when not needed does seem to help the temperature issue on my end –  Ravi Vyas Jul 11 '11 at 19:36
@Ravi I deleted my comment because I realized I could remove the battery to try to attempt to combat that specific issue. I'll be trying that soon XD –  Glendon Trullinger Jul 11 '11 at 19:38
Tried it on my device , Desire HD , No battery = dead phone :-) –  Ravi Vyas Jul 11 '11 at 19:41

I have never tried it, i will try and let you know the ans, but i think we should ask our device from recognizing usb cable Take a look hope it is usefull for you

i will try and revert with the same and nice question sir :)

share|improve this answer

This is unfortunately not possible. Android only have read APIs for battery data.

Battery charging control is internal to the Android kernel and battery IC modules. Manufacturers do change it from time to time, like HTC is having small cycles from 95-100% (a bad idea IMO), Samsung does stop charges as soon as it reaches 100%, but I've never seen a device able to stop charging before 100% to reduce battery aging :(.

At best if we're lucky, a sysfs interface might help do that, but it requires root and will differ from device to device.

share|improve this answer

Just to add to this. Samsung phones do not stop charging after 100%. As far as I'm aware they "trickle" charge past this point however they recommend you do not charge your phone past 100% for over 1 hour. Battery manufacturers like Anker also state the same so the idea of stopping the charge at 100% would be really useful. The risks of leaving the phone on charge are battery bloat and eventually cell rupture. I wasn't aware of this to start off with an killed my samsung battery within 3 months of owning the phone.

To expand on the original question. I've noticed some kernels allow fast charging. If they are able to alter the charge rate up could we alter the charge rate down (trickle) to meet a desired finish time (when your morning alarm goes off)??

share|improve this answer

Your Answer


