12

I would like to know if it's possible for the user, or for the developers to set the Wi-Fi Access Point proxy settings in Android versions 2.x (I know that it's possible for 3.x or greater versions editing the AP configuration into the Wireless settings), in order to get the settings from code in the following way:

ProxySelector defaultProxySelector = ProxySelector.getDefault();
List<Proxy> proxyList = defaultProxySelector.select("http://www.google.it");

(that should be the right way to get the current proxy configuration of the Android device)

I know there is a hidden Activity into the Android source code, called ProxySelector (please be careful, it has the same name of the java.net.ProxySelector, but it's an Android Activity and it's located on the package: com.android.settings.ProxySelector) but it sets something like a global proxy configuration that seems to be ignored by the default ProxySelector class.

This question is because it seems that for Android 3.x or greater versions the standard way to use the java.net.ProxySelector seems to work without problems, but not for Android 2.x versions. It's a changed behaviour or am I doing something wrong?

Should we use the global proxy settings for Android 2.x versions in alternative? By the way we can read the global proxy settings in the following way:

Settings.Secure.getString(getApplicationContext().getContentResolver(),Settings.Secure.HTTP_PROXY);
Community
  • 1
  • 1
lechuckcaptain
  • 1,032
  • 1
  • 9
  • 25

1 Answers1

3

I don't think there was any platform-level support for Wi-Fi proxies before Gingerbread or prerhaps Honeycomb.

Edit:
An Android engineer who works on this part of the platform confirms that the system didn't have proxies for different network types (e.g., Wi-Fi) until Honeycomb. So there is no "official" way to get the Wi-Fi proxy for 2.x.

Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
Sparky
  • 8,437
  • 1
  • 29
  • 41
  • Oh great :-O !! In order to satisfy a lot of angry users (from the current distribution, more than 95%), do you have some suggestion to solve this problem? – lechuckcaptain Mar 14 '12 at 08:34
  • Do you think that could be possible to set system-wide the system properties (`http.proxyHost`, `http.proxyPort`, ...) read by the default ProxySelector implementation (http://goo.gl/dAZ8j), so that the developers can continue to use the standard way of using the ProxySelector? – lechuckcaptain Mar 15 '12 at 08:55
  • Check this post for a more detailed explanation: http://stackoverflow.com/questions/10811698/getting-wifi-proxy-settings-in-android/13616054#13616054 – Adam Nov 28 '12 at 23:52
  • do you know if programmatically I can know if a wifi has services blockeds like whatsapp instagram, etc..? – Skizo-ozᴉʞS ツ Jul 22 '15 at 19:12