You are not logged in.

#1 2021-04-15 09:34:19

amr962
Member
Registered: 2021-02-11
Posts: 52

Prevent android from charging over USB?

Is it possible to prevent my android smartphone from charging its battery when connected via USB? I need to plug it in to load my application on it from android-studio and it seems to drastically reduce my laptop battery life, by almost 50% actually

Offline

#2 2021-04-15 11:20:59

siddhartha
Member
Registered: 2020-06-10
Posts: 9

Re: Prevent android from charging over USB?

Shouldn't this be setup in the settings of your android device, e.g. Settings > System > Developer options > Select USB configuration?

Offline

#3 2021-04-15 12:39:50

amr962
Member
Registered: 2021-02-11
Posts: 52

Re: Prevent android from charging over USB?

siddhartha wrote:

Shouldn't this be setup in the settings of your android device, e.g. Settings > System > Developer options > Select USB configuration?

It charges regardless of what I choose

Offline

#4 2021-04-15 18:19:11

siddhartha
Member
Registered: 2020-06-10
Posts: 9

Re: Prevent android from charging over USB?

Sorry, you're right. I just tried to find out and it seems is not so trivial. At least, I didn't managed. The closer I got to it was following this post:

https://android.stackexchange.com/quest … ed-via-usb.

I tried this:

adb shell dumpsys battery set ac 0; dumpsys battery set usb 0;

but the only thing I saw is that the battery percentage and the symbol of charging got stuck even after disconnecting the device... So I'm not sure if that really worked.

Hope someone else could be more precise.

Offline

#5 2021-04-15 18:33:17

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: Prevent android from charging over USB?

dumpsys seems to only change the display values, not the real charge state. Try some of the other methods.

https://stackoverflow.com/questions/307 … connection


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2021-04-15 19:14:19

amr962
Member
Registered: 2021-02-11
Posts: 52

Re: Prevent android from charging over USB?

progandy wrote:

dumpsys seems to only change the display values, not the real charge state. Try some of the other methods.

https://stackoverflow.com/questions/307 … connection

I've seen the methods that worked from that thread but I don't even have the files they're talking about. But I just realized that Android 11 support WiFi debugging, so I'll be using that

https://developer.android.com/studio/ru … e#wireless

Offline

Board footer

Powered by FluxBB