Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to force my app NOT to use the 3g data proxy setting

Tags:

android

I am developing an android app and on devices pre 4.0 (ics) the app works fine connecting to http and https backends on WiFi and 3G data connections. But on my ICS 4.0.3 device, the app ONLY connects to https via WiFi (it connects fine to http on both wifi and 3g). I realised that by manually going to the APN settings and removing the proxy, my app can connect to the https backend via 3g. So my question is how can i force httpclient to NOT use the proxy settings via code? Thanks

like image 720
Cool Dude Avatar asked Mar 28 '12 10:03

Cool Dude


1 Answers

First of all, thanks Cool Dude for answering your question yourself. I had the same problem but was not using HttpClient but instead HttpURLConnection directly. In that case the solution is the following:

myUrl.openConnection(java.net.Proxy.NO_PROXY);
like image 186
mdiener Avatar answered Nov 10 '22 00:11

mdiener