How to Use proxy for all apps in android devices?

SO many people may be want to use proxy in mobile device for any reason. But in android if you set proxy in wifi settings than it will be applied only on browsers and some other apps that determine the proxy configuration in wifi settings and use that.
but most social media applications don’t respect proxy configuration made in wifi settings. So we need a way to force all traffic through the proxy.
well there is a way and I am sharing the method here to apply global proxy in android. this method will send all the traffic through proxy for sure. because I have tested the method with local proxy server by monitoring live logs.
We don’t need any kind of external thing to apply the proxy in android device.
We don’t even need root access in device this method will work on un-rooted phones also so this will be a great plus point.
It can be done with just simple adb commands.
Just follow below steps.

=> Enable USB debug in android device from Developer option
=> Screenshot by Lightshot
=> Download android-platform tools from google. Just make simple search on google you will find easily.
=> Unzip the file you have downloaded fro platform-tools.
=> Open the folder which have adb.exe
=> Now open command prompt at the directory which have adb.exe file.
=> Now connect your device to PC with USB cable.
=> Your device will ask for adb access permission whenever you have connected the device 1st time after enabling the usb debug option.
=> Just accept or grant the permission from the dialogue box automatically appeared on device.
=> Screenshot by Lightshot
=> If no dialogue appeared still just wait. When you will run 1st command then the dialogue will 100% appear on mobile screen.
=> type the command : adb devices
=> Check if you can see your device is showing connected or not.
=> check screenshot Screenshot by Lightshot
=> If you can see the device connected than you can proceed further.
=> The connected devices will be shown in Command prompt as below.
=> Screenshot by Lightshot
=> If you can see the device connected like above run second command or just solve the connection issue if you have any.
=> After successfull connection you have to keep two commands to remember. One for adding the proxy and one for removing the proxy.

#To Add Proxy
adb shell settings put global http_proxy IP:PORT
Example:
adb shell settings put global http_proxy 192.168.1.252:8080

#To Remove Proxy
adb shell settings put global http_proxy :0

Check the above procedure and let me know if you find any difficulty. I am happy to help.
And the best thing in this method is it will also work after reboot. So once you setup the proxy just don’t worry your all traffic will go through the proxy. And whenever you want to remove the proxy just run the command to remove it.

9 Likes

Nice share :+1::pray:

1 Like

Really nice share, but after adding the proxy, the device has to stay connected to the pc?
if i disconnect the mobile from the pc what happends it stops?

1 Like

No need to keep it connected to PC. Just disconnect after setup and enjoy

1 Like

Really useful share, especially because I’ve seen many users looking for this so your share should be very helpful. Cheers

2 Likes

Thanks for the share!

Even easier is using this app which applies the global proxy automatically

6 Likes

Thank you for sharing! It’s a great guide for those who want to use proxies but don’t want to root their phones.

Thanks for this, fits well with Appium.

Q: Why would you want to set an Android to run on a proxy?

Thanks @barmer :pray:

Yes there are some more apps also available. But using Extra apps will cause additional battery usage. So if anyone concerned for battery backup than ADB method will be suitable it doesn’t use extra battery because it’s just a configuration.

Yes there will be no issue with other services or process. So you can use for any kind of setup.

I will post the automated bat file for adding/removing proxy in Android phones here soon. It will help users who are not familiar with adb commands

Is there a way to make this adb method work for proxies that have user:pass authentication?

@barmer Is there another similar app like the one you posted above that can use user:pass auth too?

1 Like

I don’t think that method will work for user:pass authentication.
But if you want to use Proxies with user:pass authentication just use College Proxy App from Playstore. Below is the link for the app.

3 Likes

do these apps works in instagram application?

Yes because these apps basically use Proxy connection over VPN Tunnel. So each request will go through the VPN tunnel and configured proxy. If you don’t want to use any third-party apps in your phone I have described how to set global Proxy by adb commands in this thread you can also use that method. It’s working 100% for all apps. I am using my Self for my projects.

1 Like

Thanks i appreciate it. The app and script both are working for me but while using app the connection speed is very low idk why

Because it uses two gateways 1st is the VPN tunnel and 2nd is the Proxy. So the request will have to pass through multiple layers of network so it will probably take some delay to perform the operations. The adb command method is definitely a good go if you want to use Proxy without consuming additional battery.

hi
i want to grab https traffic with fiddler proxy, i tried this method but didn’t work for me, some of my apps just use this and other (special one that i want to see it traffic) lost connection. how can i fix this?

thank you.

If you just want to sniff packets you can use MITM (Man In The Middle) Proxy apps. So many available on Play Store. This adb method just simply force all traffic to go through specified proxy. If you are running your own proxies just enable activity logs and see if you get what you want to see. If you still need help just hit me a DM and let me know your requirements in details I will try to help you as much as possible.