-3

I just tried and found that you need to modify a file:

sys/class/power_supply/usb/device/charge

its default content is 1 which means 'enable charging' you need to set it to 0 to 'disable charging'

$ su   
$ echo 0 > /sys/class/power_supply/usb/device/charge

I tested on Nexus 4 and it's working successfully.

user3395818 has posted this answer. I have Nokia 3 and it comes with Android 7 Nougat. I am new to Android. How to perform the above task?

Please explain in detail with steps.

  • 1
    Note that the content of /sys can heavily vary between different devices, and even if there is such a file there, some devices might not allow you to modify it, or the modification would not come into effect. – Andy Yan Aug 12 '17 at 0:41
  • Also to add to what @Andy says, it may not work on all devices – beeshyams Aug 12 '17 at 1:34
  • It might make your question easier to understand if you edit and add a link to the answer you're talking about. – Dan Hulme Aug 12 '17 at 12:36
2

What you have to do is:

  1. Root your phone (voids warranty, also risky if not handled properly).
  2. Download any root explorer like ES Explorer.
  3. Go to that path you've given
  4. Edit that file and set it's value to 0.

You can also choose terminal emulator as that's the only thing in which you can execute that code.
I'll recommend not to root your new phone. That's upto you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.