0

I need to know a way, if possible, to disable USB battery charging while my Nexus 7 is plugged to my pc. I'm doing some tests on my devices and for better result I need the device plugged but not in charging. I've read this post before, but the suggested path doesn't exit on my device. Has someone had my same problem before?

Community
  • 1
  • 1
Antonio Prota
  • 13
  • 2
  • 4

3 Answers3

1

No, there is an IC chip in mobile that monitors the various conditions like (phone/battery temperature, battery level etc..) and decides whether to charge it or not when charger is connected. This task is somehow H/w oriented operation. You cannot change the battery charging task.

However you can do one thing that will appear to user that battery is not charging. You can make the battery charging icon (in status bar) to battery mode icon. This can be achieved using Android Broadcast. You create the broadcast with intent Intent.ACTION_BATTERY_CHANGED that will broadcast just after 1 sec of the default Intent.ACTION_BATTERY_CHANGED intent broadcast and passes the relevant data with Bundle.

Still Can you describe why you need to stop the battery charging.????

Rahul Raina
  • 3,322
  • 25
  • 30
  • I need to work with Batterystats (http://developer.android.com/tools/performance/batterystats-battery-historian/index.html) and Systrace (http://developer.android.com/tools/help/systrace.html) at the same time, but the first needs to work unplugged unlike the second. – Antonio Prota Jan 11 '16 at 11:39
  • My answer would be that I'm continually USB debugging, and continuous charging (even at 100%) is very-very bad for the battery capacity – Imre Nov 19 '19 at 12:06
1

I came here 6 years late but this works:

adb shell dumpsys battery unplug

or

adb shell dumpsys battery set usb 0
spartygw
  • 3,289
  • 2
  • 27
  • 51
-1

The outer pins of a standard USB connector are used for power. You could try removing them from your cable, leaving only the inner data pins.

For more info on the pins, see http://pinouts.ru/Slots/USB_pinout.shtml

Youcam39
  • 102
  • 5
  • 1
    I've isolated the outer pins with non-conducting tape but when I plug the device it's not seen by ubuntu. Maybe because power is needed to link the device to the pc? – Antonio Prota Jan 11 '16 at 13:32
  • 1
    Won't work. USB uses the power lines to detect the connection, the data lines will not work without the power lines being connected. So if you need need USB connected the only way is to find a way to disable changing on the phone side. – diidu Feb 28 '17 at 10:21