How to set system wide proxy in ICS

2019-05-10 22:43发布

问题:

For Android 3.x and before, you can bring up a hidden UI called com.android.settings.ProxySelector. It is set in Settings.Secure.HTTP_PROXY and used by Mobile network (WiFi network does not always work). However for ICS, I can still bring up this hidden UI, but it does not seem to set proxy anymore. When I click "Done", then I check Settings.Secure.HTTP_PROXY or system property http.proxyHost, neither is set.

So is there a way in ICS that would allow me to set global proxy much like what I can do before with the com.android.settings.ProxySelector UI? Thanks!

回答1:

Unfortunately the hidden activity "com.android.settings.ProxySelector" is not designed for setting the proxy for Wi-Fi networks. In fact you can set a global proxy using this activity but for standard applications you won't see a change.

For example the default browser use this setting only for MOBILE networks and completely ignore it for Wi-Fi networks.

Of course you can read the settings in your personal app using this library, but you can't expect that other applications will do the same :(

Please let me know if everything is clear. Anyway I'm trying to cover the problem here, so you can find more resources on this topic.



回答2:

if the device is rooted. you can edit the Iptable