如何用户/开发者可以为版本2.x的Andr​​oid的代理配置?开发者、版本、用户、oid

2023-09-12 03:35:46 作者:典型小二货

我想知道这是否是可能的用户,或为开发者设定的Andr​​oid 2.x版本的Wi-Fi接入点的代理服务器设置(我知道这是可能的3.x或更高版本编辑AP配置成无线设置),以获得在以下方式从code中的设置:

 的ProxySelector defaultProxySelector = ProxySelector.getDefault();
名单<代理> proxyList = defaultProxySelector.select(http://www.google.it);
 

(应该是这样的right方法获得Android设备的当前代理配置)

我知道有一个隐藏的活动到Android源$ C ​​$ C,所谓的的ProxySelector 的(请注意,它有 java.net同名。的ProxySelector ,但它是一个Android的活动,它位于第包: com.android.settings.ProxySelector ) 不过这台类似的东西似乎是由默认的ProxySelector类忽视的全局代理配置。

这个问题是因为它似乎为Android 3.x或更高版本,以便使用标准方法 java.net.ProxySelector中似乎没有问题的工作,但不对于Android 2.X版本。这是一个改变的行为,还是我做错了什么?

我们应该使用的Andr​​oid 2.X版本的替代全局代理设置?顺便说一句,我们可以阅读下列方式全局代理服务器设置:

Settings.Secure.getString(getApplicationContext().getContentResolver(),Settings.Secure.HTTP_PROXY);

解决方案

我不认为有Wi-Fi的代理姜饼或prerhaps蜂窝在任何平台级支持。

编辑: 一个机器人工程师谁的作品在这部分的平台,证明该系统没有代理不同的网络类型(例如,无线网络),直到蜂窝。因此,有没有正式的方式获得了Wi-Fi代理为2.x的。

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);

解决方案

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.