4

I use the following code to set up Android HTTP proxy via command-line tool adb.

adb shell settings put global http_proxy <ip>:<port>

However, when I want to undo the proxy settings, the following code does not remove the proxy. Although it clears those system attributes, the Android device still tries to connect <ip>:<port>

adb shell settings delete global http_proxy
adb shell settings delete global global_http_proxy_host
adb shell settings delete global global_http_proxy_port

I have to reboot the Android device to remove the proxy. Is there an approach to clean the proxy without rebooting the device?

The Android version is 7.0.

To reproduce this problem:

# Set up a proxy
adb shell settings put global http_proxy <ip>:<port>

# Remove them
adb shell settings delete global http_proxy
adb shell settings delete global global_http_proxy_host
adb shell settings delete global global_http_proxy_port

# Then open a browser, it will still connect to the proxy ip and port
user11712282
  • 43
  • 1
  • 2
  • 8

1 Answers1

11

Do:

~$ adb shell settings put global http_proxy :0
Irfan Latif
  • 498
  • 2
  • 9
  • 24
  • Thanks, where did you find this solution? I think it is not in the documentation. Do we still need to delete http_proxy, global_http_proxy_port, global_http_proxy_host or it is not needed? – baptx Aug 17 '20 at 14:41
  • 1
    @baptx can't remember where I came across this information, but I think I learnt (or figured out) that while writing this answer: https://android.stackexchange.com/a/217801/218526. // No. Part before colon is the host which is cleared. `0` port is invalid, so doesn't affect. – Irfan Latif Aug 17 '20 at 15:36