Hi Guys. Have you already downloaded Proxy Settings? No? You should! Please stop reading this post if you haven't already done! It's the first step!!
We need to provide the users simple and easy solutions. But I already told you that...
Today I need to update some comments I made regarding how to use the system proxy settings, for the following reason: a couple of months ago (ok, maybe I'm not The Flash), Google Developer Jesse Wilson spoke about the best practices for Android’s HTTP Clients, so I have to refresh the instructions for the developers in order to better handling the proxy settings in their own applications.
So what did Jesse say? I don't want to repeat what he already well explained. Basically the condensed part of his post is that if your target is >= Gingerbread (2.3) you should use HttpURLConnection for your Http Client.
So first I want to point you to the Android API reference:
and second, I need to highlight some important things regarding the use of the Proxy Settings following the update guidelines.
If you open the Android API Reference for HttpURLConnection, you can find a short comment regarding Proxy handling:
And here that's all you need to get something through an HTTP request. You can take and use the following example. It's free, and it works easily.
As I already explained here, you just need to get the system settings, build a java.net.Proxy object and pass it to the openConnection method. If the user hasn't customized the settings, you can just continue how you were doing before.
10 Lines of code. You have the power Luke, use it in your application!