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

前端 未结 1 1379
慢半拍i
慢半拍i 2020-12-11 11:19

I have been running some testing with wifi proxy settings on a Motorola Xoom with Android 3.2. So first of all, it is a big step forward comparing to 2.x releases. now if yo

相关标签:
1条回答
  • 2020-12-11 11:42

    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.

    0 讨论(0)
提交回复
热议问题