Is there any way to add Proxy IP and Port in android application so that the internet access will be routed through the Proxy?
From a link i got the information
try {
Settings.System.putString(getContentResolver(),
Settings.System.HTTP_PROXY, "127.0.0.1:100");//enable proxy
}catch (Exception ex){
}
But by trying this System variable cannot be resolved?
Please help!!
Thanks in advance
HttpURLConnection con =null;
URL url = new URL("xxxxx");
Proxy proxy=new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(android.net.Proxy.getDefaultHost(),android.net.Proxy.getDefaultPort()));
con = (HttpURLConnection) url.openConnection(proxy);
Is this okay?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With