yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] brownsmell:
The battery is working with chemistry and there is always movement on a chemical level, this is why a battery can only last ~ 5 years at best. It takes a lot of research to find the best practices but we know that cycling no lower than 20% and no higher than 80% is best for the lithium based batteries (LiPo for sure and I think LiFe and Lion would be similiar not sure so I will just assume they are please correct me if I am wrong my research was on LiPo for quadcopters).

50% charge is recommended for storage, the higher you go, the shorter the battery lifespan. 80% may give a very similar lifespan to 50% I could not offer a guess. This is consistent with the principles behind quick charging 3.0, where you can put more power (more V and A) into the battery quicker until it is almost done charging at 80% or 90%.

In theory milux, your instinct and everyone else's seems to be correct about not cycling +/- 3% constantly. The more stable, the better. The less chemical reaction you have in the battery (charging and discharging), the longer it should last. So your idea of using mV instead of % would improve the app's effectiveness on battery lifespan. By how much, if any, I have no idea.

This is definitely a must have app for ppl that are neurotic about taking care of their phone! Lifespan is more important than short term performance, so I would bet that everyone here has a case and screen protector on (or has them coming in the mail like I do).
[Android Apps and Games] blueberry.sky:
Can someone with a samsung device try this:

Plug in usb

Toggle /sys/class/power_supply/battery/store_mode (set to 1, then back to 0)

Toggle /sys/class/power_supply/usb/online

Check if charging has been enabled again (give it time and see if charge % increases).

Might force it to recognize that store_mode has been reset to 0.
[Android Apps and Games] Einheit-101:
Doesnt really work as intended on a Droid Turbo, eh?

http://i.imgur.com/BVm8VP9.png

Device randomly decides to stop charging at 25% or whatever percentage lol
[Android Apps and Games] juppi:
Tasker profiles and tasks to enable wireless charging if akku is below 70% and disable if akku is above 80%.

This tasks and profiles are very simple.

Working on Galaxy S7 with superman Rom 2.0. I think that could work an other roms or samsung phones with wireless charging too.

I hope this zip file contains everything that is needed.
[Android Apps and Games] maik005:
Thats it, thank you! I also made one by myselfe. which is a litte bit different but works the same.
[Android Apps and Games] juppi:
On my S7 i cant write to the file "/sys/class/power_supply/usb/online"
[Android Apps and Games] blueberry.sky:
Even as root?

In terminal do

su [enter]
echo 0 > /sys/class/power_supply/usb/online [enter]
echo 1 > /sys/class/power_supply/usb/online [enter]

(You should get a new prompt with a # after doing su. The # shows that you are now root / superuser)
[Android Apps and Games] frequentc:
The file is read only on my Note 3 (even with root).

The only file in the usb directory that is writable is "uevent".
[Android Apps and Games] Hakkinen3K:
Nice app, congratulations.

It's possible to add a sound when limit is reached?

Thanks
[Android Apps and Games] Gregbol:
Hello.

Excuse me to pose as a hair on the soup, but is someone solved the store mode (for note 3)that does not recharge after having a cap at 85% for example.

Thank you.

:)
[Android Apps and Games] 4rtcytech:
Hi..

Is there any difference between

/sys/class/power_supply/BATTERY/charging_enabled and

/sys/class/power_supply/AC/charging_enabled ?

I have both, which one should I choose?

Thanks..
[Android Apps and Games] guest4711:
Cause you are not telling which device and ROM you use noone could tell it. It's possible that both files are the same (hardlinked). You could test that by changig one and looking at the other.

Another test: Connect your charger to the phone, open a terminal and try to finish charging; e.g.

su -c echo "0" > /sys/class/power_supply/BATTERY/charging_enabled

and see how it works. If not, try the other file...
[Android Apps and Games] 4rtcytech:
Well.. It looks like the two are not linked to each other.

I've tried with /sys/class/power_supply/BATTERY/charging_enabled and it works.

I have not tried with /sys/class/power_supply/AC/charging_enabled.

Thank you..

---------- Post added at 02:49 PM ---------- Previous post was at 02:31 PM ----------

I just tried to change value /sys/class /power_supply/AC/charging_enabled with terminal, and it can not be changed.

The same result when changing it using root explorer.
[Android Apps and Games] firoz3321:
I am using 1.0.4 on oneplus 5 with oreo leaked beta 2.

Once the battery reaches the upper threshold tge app stops charging (which is good) and immediately app crashes. After this the charging is forever disabled. Until i reopen the app and toggle the service off and back on.
[Android Apps and Games] godzulu:
I've got a Pixel 2 XL, 8.1. 1.0.4 installs, but can't open app. Says device not supported. Any ideas? I've got this running on my Nexus 6p, 8.0 and it's seems to be working just fine. I also noticed that in the sys files charge enable is not in that file. Different files altogether.
[Android Apps and Games] webbrowser:
On my pixel 2 xl running 8.0, the file is input_suspend.

Please let me know if this still works in 8.1?
[Android Apps and Games] marbertshere:
Use the fork provided by [MENTION=6280728]xdnax[/MENTION] a couple pages back. It's working great on my Pixel 2 XL running 8.1
[Android Apps and Games] godzulu:
Cool, I see input_suspend. It's set to "0". Guess I'll try one of the other versions of to see if one will open. 1.0.4. does not open on this phone. Pixel 2 XL, 8.1
[Android Apps and Games] godzulu:
Just now saw your post. I downloaded from GitHub. It's working, thanks. BTW, it's post #1337. Thank you
[Android Apps and Games] :
Can you elaborate what your problem was and what was fixed on my fork? Thanks!
[Android Apps and Games] godzulu:
I tried the Op's 1.0.4 and had it working on my Nexus 6p, PN 8.0. *worked great but using same apk on Pixel 2xl, app would not open, and I got device not supported. *That's where it was suggested to try your fork. It works just fine. High five and thanks!
[Android Apps and Games] ACiDxCHRiST:
So I have done some more testing, and just enabling Double-tap to Check Phone, does NOT prevent the screen not coming on issue. It appears that Always On Display is the only option that will truly prevent it.

I am now also pretty sure that the issue has nothing to do with Battery Charge Limit. This is a Android 8.1 issue on the Pixel 2 XL and can be fixed by rebooting the vast majority of the time. I will just have to wait for the next monthly security patch and hope it gets fixed.

(the problem fixing itself at the same time as uninstalling Battery Charge Limit that I posted about earlier, seems to have just been coincidence)
[Android Apps and Games] ecocat:
Hello

I have an unsupported device on which I want to use its magnificent application

I've done my detective work

Device: Jelly Pro

Manufacturer: Unihertz

/sys/class/power_supply/battery/

Status

Connected the charger displays "Charging"

Not plugged in the charger "Not charging"

Present

Plugged in the charger "1"

Disconnected charger "1" Also

I understand it's the status file. With the charger plugged I changed the permissions for write and changed the content to "Not charging". I gave a permission change error and the application told me that some filesystems do not allow editing permissions. Now when you open "status", this text appears: "Sush: <stdin> [86]: Cat:/sys/class/power_supply/battery/status: Permission denied

Thanks a lot!
[Android Apps and Games] magarto:
How can I make it work using adb in a non rooted device? Thanks in advance
[Android Apps and Games] mgehlhaar:
I'm on Pixel with Android 8.1 App version 1.0.5 and it looks like resetting battery stats isn't working. It says it was successful but old battery stats in the settings are still there.
[Android Apps and Games] :
I need you to confirm two things.

1) Does the stats reset inside the app when you manually hit reset battery stats?

2) Does it work when you have it checked to automatically do it and you hit your charging limit?

I am on Shamu 8.1 and just confirmed manually it works at least.
[Android Apps and Games] :
Can you also please provide a picture of the settings screen so I can see which settings you have applied and what cntrl file you're using? Thank you!
[Android Apps and Games] magarto:
xdnax, is it possible to do?
[Android Apps and Games] :
After briefly looking over some stuff, I'm not sure a root work around is possible since the app directly modifies file in the system partition... I am not sure if there is anyway to access those files without super user access
[Android Apps and Games] magarto:
Maybe using adb pull and adb push.

I will try it https://www.modmy.com/how-modify-hosts-file-your-android-device

Anyway, will this apk force close if I don't have super user support but I have modified the file?
[Android Apps and Games] :
Well the app doesn't work like that... Very basically, it pushes changes to the necessary file when it's told to, which is when it hits a limit or has to float in between, it's not as easy as making one static change and that being it. Not sure if it can work properly and just as effectively without root.
[Android Apps and Games] godzulu:
View attachment 4367649View attachment 4367650View attachment 4367651

Sent from my Pixel 2 XL
[Android Apps and Games] :
And it works like a charm? I'm getting my taimen in 3 days and was curious if everything was working 100%
[Android Apps and Games] marbertshere:
Seems to work just fine. Not sure if battery stats are not automatically resetting or I just didn't charge it all the way to the upper limit last time I unplugged.

Edit: it appears that it works.
[Android Apps and Games] :
Unofficial xdnax fork V1.1.2 is now built and available!

This build catches up the unofficial version to the main branch in terms of commits and then adds a lot of improvements to my personal forked app. Please continue to let me know any abnormal bugs. Thanks and enjoy!
[Android Apps and Games] magarto:
Where can we download the build? I can only see the zip or tar
[Android Apps and Games] aamadorj:
Here: https://github.com/xdnax/BatteryChargeLimit/tree/local/app/release
[Android Apps and Games] IonutGherman:
[MENTION=6280728]xdnax[/MENTION] can you add htc one m8 and m9 control file? There is a pull request on sriharshaarangi's github.
[Android Apps and Games] magarto:
Thanks, I was searching it in the release tab
[Android Apps and Games] :
I did see that and I certainly will look into it
[Android Apps and Games] brackenhill_mob:
Any chance of supporting Google's Pixel C tablet?
[Android Apps and Games] guest4711:
Yes, if you do some detective work as described in OP: [APP][ROOT][4.4+]Battery Charge Limit v1.0.4 - https://xdaforums.com/android/apps-games/root-battery-charge-limit-t3557002/post71040651:

If the app says "your device is not yet supported"

There are various control files in different devices (due to OEMs), and toggling the values in them (0 and 1) makes it possible to enable and disable charging via software (might not be possible for every device), though the charging cable is still physically connected.

Since we cannot own every device, it is impossible for us to find every file. We can support a lot more devices with information provided by testing possible files on different devices by you, the people in the community.

Hence, for support to be provided to other devices, you need to do some detective work to find the files on the respective devices. Please refer to this file for control files of currently supported devices, so you can know where they are generally present:https://github.com/sriharshaarangi/...aster/app/src/main/res/raw/control_files.json
[Android Apps and Games] svbarbosa:
I have a suggestion for you devs:

Why not implement a "Custom" option in "Select Control File" settings that would read the necessary fields from a CSV text file.

It would contain the same fields as in source code:

File: "/sys/class/power_supply/battery/battery_charging_enabled"

Label: "battery_charging_enabled"

Details: "Nexus/Pixel"

ChargeOn: "1"

ChargeOff: "0"

and of course assume experimental is True

Nothing fancy. the file could be /sdcard/batterychargelimit/customcontrol.csv.

If the file exists and looks ok the app would add the option in settings. No need to change app to test new settings.

This way users could test and implement new phones by themselves. Even exchange custom settings files.
[Android Apps and Games] dranx.:
Thank's it work for me, it's just what i need for my smartphone !
[Android Apps and Games] :
I think that is a great idea. However, I am going to wait for the main devs to implement this, until I have time to seriously look at where all this code is found. I have my own ideas of implementation, but they may like it another way and wouldn't want to waste time... I'll get back to you on this.

However, users can use an ADB shell via a PC, and using su I believe, use a command like "echo 1 > /sys/class/power_supply/battery/input_suspend"... This will allow you to send in a value to either enable/disable charging to any file. Find one that reacts appropriately and there ya go.
[Android Apps and Games] ulipo:
With Sultanxda Lineage 14.1 on Oneplus One it disables charging when the limit is reached, but soon afterwards the service is disabled and after a few seconds the phone starts charging again, in a contiuous loop.

Control file in use is "charging_enabled" (generic)

I think the problem could be in the file the app checks to see if the phone is plugged and enable or disable the service
[Android Apps and Games] OPOt585:
In my oneplus one with Sultan's rom the screen turns on after the limit is reached and stays on too... :silly:
[Android Apps and Games] :
Good News! I have started to implement a function to let users enter custom control file paths, enabled and disabled values. It will still take me another day or two to finalize as Kotlin is not my main language so I am much slower. But if it works how I'm thinking, this should let users test custom values on the fly. Stay tuned, no promises, but it looks like it's coming! Merry Christmas to all as well!
[Android Apps and Games] BRNko:
After uninstalling app, my S7 got low charging issue

I have the Galaxy S7 (G930F) with Nougat firmware. When I install this app, then I got the 70% issue. But...when I disable this app and remove it, then my phone is charging slower than before. Before installation this app my phone was charging normally at 5V and 1,85A and with fast charging enabled it was 9V and 1,45V. Now, after uninstalling and restarting phone it is 5V and only 0,5A. The fast charging isn't working at all even if I re-enable it. It's still at 5V and 0.5A. Please help :(

Nougat 7.0, build: NRD90M.G930FXXS1DQK1
[Android Apps and Games] mgehlhaar:
It doesn't work both ways. I also have to say that the limit set doesn't work. It loads the battery up to 100%. The service icon is still there when it is over 80%, which is the limit I go with, and battery is then still loading until it's full. I'm using the Nexus/Pixel control file.
[Android Apps and Games] realista87:
https://fossdroid.com/a/battery-charge-limit.html

here i see 1.0.5 v ... is it fake version? opening thread is updated up to 1.0.4
[Android Apps and Games] guest4711:
The last unofficial version by [MENTION=6280728]xdnax[/MENTION] is 1.1.2, see https://github.com/xdnax/BatteryChargeLimit/tree/local/app/release
[Android Apps and Games] :
If anyone would like to help beta test the new manual Ctrl file function, please hit me up on telegram [MENTION=6280728]xdnax[/MENTION]. I'm not quite sure it's totally working so I will release betas there so users can confirm to keep this thread clean.
[Android Apps and Games] :
Weird. Got my Pixel 2 XL running 8.1 Dec. Patch and it doesn't seem to work. Same setup, but when it hits the limit, the charging continues but will kinda flicker on and off. Interesting. Once I release my next build, I'll need ya to help me test :) [MENTION=3064020]godzulu[/MENTION]
[Android Apps and Games] marbertshere:
What do you mean flicker on and off? As if someone pulled out the cable and placed it back in? I haven't seen that on mine.
[Android Apps and Games] ulipo:
That's more or less what happens on my Oneplus One with Sultanxda Lineage 14.1... it flickers on and off every about 10 seconds...
[Android Apps and Games] hgmichna:
Rapid charge-discharge cycle

Check whether it is, in fact, 6 seconds. I had that with earlier versions, but only on powerful chargers above 1 A current.

Since slow-charging also extends the battery lifetime, it is better to charge with only 500 mA overnight, which, in my case, prevented the rapid charge-discharge cycle. This leads to problems of how to make the phone draw only 500 mA or how to find a charger that delivers only 500 mA (difficult). I won't go into that right now, unless there is pronounced interest.

I thought the problem was meanwhile fixed in the latest versions of the app, but apparently not entirely, if you still observe it.
[Android Apps and Games] brackenhill_mob:
Pixel C

For my Pixel C I've searched for every file in /sys containing "charg" and this is the list that came up. None of these match anything in the json file. What do I need to do now? I'm afraid to make changes without some guidance in case I mess up!
[Android Apps and Games] :
V1.2.0 Beta build is here with a first-attempt at users entering their own CTRL files. If you get ANY FORCE CLOSES OR ERRORS, please post a log and an explanation on how so I can debug it. It is hard for me to test now. Also, test control files you know using the custom method so I can verify it actually works. Thanks guys!

If the app has issues and you are using A CUSTOM CTRL FILE setup, please let me know as this may be due to wrong information entered by the user, targeting wrong files, etc. And not the app itself
[Android Apps and Games] :
Another beta update, which seems to be working much better now! I added a heads up in the custom control file section as to some advice if custom files/values are not working. Sometimes, enabling different settings, as noted, helps... Please feel free to give feedback and hopefully this is helpful to some people! Also, thanks to my beta testers :)

If no one posts any major issues or bugs, I will polish off this feature and release it stable. I believe I got most issues, but you never know.
[Android Apps and Games] Gregbol:
Hello.

for my part there is a discrepancy between the available files store-mode etc. .. and the current file indicated in the app?
[Android Apps and Games] IonutGherman:
show your full path here to your battery folder.
[Android Apps and Games] Gregbol:
That?
[Android Apps and Games] Gregbol:
/sys/devices/battery.94/power_supply/battery/store_mode

With miexplorer i don't understand?

Where is charge_disable?

Nothing in /sys with es explorer
[Android Apps and Games] BigM69:
I'm Glade I found this app, because I usually charge my device at night and sometimes I forget to unplug it when it reaches 100%. With this app I won't have to worry about it now.
[Android Apps and Games] :
This is for advanced users to set their custom files/values. If you do not know what you are doing, get out of there - it is not for you.
[Android Apps and Games] post-mortem:
I am interested!

Those of us with SGS3's have been unable to get the app to work as expected. It initially seems to work, but after an unpredictable length of time, it will continue to charge up to 100%. I've only found the app to work correctly when I'm charging from a USB port (500mA).
[Android Apps and Games] backslashV:
Is there a way to totally disable battery charging?

If not, can you tell me what things I need to change in the source code to achieve this/lower the "Limit charging to %"?

Does it suffice to change "maxPicker.minValue = 40" to "maxPicker.minValue = 10" and recompile to lower the "Limit charging to %"?

Thanks
[Android Apps and Games] :
I'm kinda confused on what you're asking
[Android Apps and Games] backslashV:
Nvm. I should've adjusted the "recharge below" value.
[Android Apps and Games] hgmichna:
Overcharging

Even without this app you don't have to worry about it, because that is what every Li-ion charger does anyway. Before reaching 100% it lowers the charging current, thus limiting the high voltage, and upon reaching 100% it stops charging altogether. Some may go to a trickle-charge mode.

If it didn't do that, your battery would explode. Disconnecting upon reaching 100% makes little sense.

The purpose of the app is to limit the charging to a lower voltage, like a state of charge of 80% or even 60%, which extends the lifetime of the battery tremendously.
[Android Apps and Games] BigM69:
[MENTION=2893530]hgmichna[/MENTION] thanks for explaining that now I understand what the app is actually used for. I was thinking something totally different, lol. ?
[Android Apps and Games] hgmichna:
Rapid charge-discharge cycle

I know of two methods to limit the charging current to 500 mA. One is based on the EPS (Common External Power Supply) standard, which was based on a Chinese standard and which used to be followed by most smartphones. Essentially it says that shorting (or connecting with a low-value resistor) the two data lines signals to the phone that it may draw a higher current than 500 mA. I am not sure whether the newer phones with quick-charge capability still follow this standard. Because of this standard, most chargers short the two data lines and deliver currents between 1 A and 2 A.

Since that is what we don't want, a solution would be to use a USB cable where at least one data wire is cut or to crack open the charger and cut at least one data line.

[Background information indented.]

Older (non-USB-3) USB cables have four lines, two for power and two for data. A legacy charger does not need and does not use the data lines, other than for this kind of signalling.​

The other method is used by all chargers anyway. If the phone draws a higher current than the charger can deliver, it just lets the voltage drop. At 4.75 V the voltage is outside the USB specification and every phone will reduce its charging current automatically.

For those who missed electricity and particularly Ohm's Law at school, it is primarily the phone that determines the current, not the legacy charger. The only thing a simple charger can do to prevent overload is to let the voltage drop to reduce the current.

iPhone chargers work differently. They actually exchange data with the phone to control the charging process, a much more complex and expensive method that prevents the use of cheap third-party chargers, a typical Apple behavior.

I don't know how the new quick-chargers for Android phones work. I only know that there are different standards, one of them provided by Qualcomm and built into their chip sets.​

One way to achieve this is to find a charger that is designed to deliver only 500 mA. Another is to use a long, thin, cheap USB cable that has a high resistance. Any cheap, thin USB cable longer than 2 m will probably do.

In theory one could cut the cable and insert a 0.5 Ohm resistor, which would take away 0.25 V at 500 mA and thus make the phone reduce its current. But this requires tools and materials and is probably too awkward in practice.

I have seen a 500 mA charger with two USB ports. Unfortunately it charges with up to 1 A when only one port is used, so that is not a solution.

If the charger manufacturers were clever, they would produce a special line of low-current overnight chargers. I would definitely buy one.

Low current charging solved the 6 s on-and-off cycling of the Battery Charge Limit app, but this may be a fluke of the app that can likely be corrected in the app. If it switches charging on and off after 6 seconds, it could obviously detect that and change the non-charging interval from 6 s to, say, two hours. Problem solved.

And let us not forget that, while a low charging current will extend the lifetime of the battery, the app, if it works well, will extend it a lot more.