How Android application decide if they want to use network proxy or not

梦想与她 提交于 2019-11-28 13:07:48
lechuckcaptain

On devices with API version >=11 (Android 3.1 and greater) the answer is here:

Android's proxy confusing documentation resources

You can simply call the getDefault() method from ProxySelector class and get the default Android implementation of the ProxySelector.

ProxySelector defaultProxySelector = ProxySelector.getDefault();
Proxy proxy = null;
List<Proxy> proxyList = defaultProxySelector.select(uri);
if (proxyList.size() > 0)
{
  proxy = proxyList.get(0);
  Log.d(TAG, "Current Proxy Configuration: " + proxy.toString());
}

I think that some Android applications (you said Opera and Firefox) simply doesn't do this check but implements some native proxy handling not caring of how the system work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!