9

Genymotion 2.2 & Android 4.0

I want to set a global HTTP proxy in Android, and all Apps will go through this proxy.

Now I can only do this in GUI as following way: Wi-Fi -> WiredSSID -> Modify Network -> show advanced options

Is there any way to set the WIFI proxy via adb shell?

I've Googled and tried several ways such as:

 1. export http_proxy xxx
 2. setprop net.gprs.http-proxy xxx
 3. sqlite3 /data/data/com.android.providers.settings/databases/settings.db; INSERT INTO system VALUES(99,'http_proxy','xxx.xxx.xxx.xxx:xxxx')

and nothing worked.

19

On my Android 7 and 8 devices:

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

Seems the setting is lost at reboot, however.

5

on master device:

  1. Configure wifi proxy manually
  2. adb pull /data/misc/wifi/ipconfig.txt

on second device:

  1. adb shell svc wifi disable
  2. adb push ipconfig.txt /data/misc/wifi/ipconfig.txt
  3. adb shell svc wifi enable
1

I posted this over in this StackOverflow question and it looks like it would work for what you are trying to do.

I developed an app that will allow you to change the proxy from adb for use in my own automation setup and it has been working reliably for me so far. You can look at the source and download the apk from github. All you have to do is install it on the device you want to automate proxy changes and then run an adb command to have the app set your proxy settings. More details on how to use it are in the README on github.

  • We used a method like this for some time but for anyone reading, it only works for Android <6. – Crummy Jun 22 '18 at 6:17
  • @Crummy maybe it was true at that time. It works for Android 6.0 and 7.0 now. – Sufian Nov 15 '18 at 15:09

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.