3

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!

Safecoder
  • 1,035
  • 2
  • 17
  • 32

2 Answers2

4

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.

lechuckcaptain
  • 1,032
  • 1
  • 9
  • 25
  • Thanks, @LeChunk! What I noticed is that com.android.settings.ProxySelector does not work for mobile network either for ICS devices. Even after I set proxy in the UI, if I do Settings.Secure.getString(getApplicationContext().getContentResolver(), Settings.Secure.HTTP_PROXY), I will not get anything, meaning it was not really set. Did you see the same problem? I also do System.getProperty("http.proxyHost"), but also nothing. – Safecoder May 13 '12 at 17:06
  • Just modified my original post to be more clear that I am more concerned about mobile data side than Wifi side. – Safecoder May 13 '12 at 17:34
  • Unfortunately I don't have an ICS device with an official ROM installed. But I tried on an unofficial ICS ROM seems that the method: `Settings.Secure.getString(getApplicationContext().getContentResolver(), Settings.Secure.HTTP_PROXY)` always return null. Don't know why. This is another clue that confirm that we shouldn't use the `com.android.settings.ProxySelector` activity on newer versions. – lechuckcaptain May 14 '12 at 13:20
  • Yes, that's what I see on my device as well. I also tried ICS emulator and same behavior. So this activity has no effect now? Then how can I set proxy for mobile network then? Some carriers don't have APN that the user can edit. – Safecoder May 14 '12 at 21:38
  • I think that you just need to edit the APN settings into your device. – lechuckcaptain May 16 '12 at 07:32
  • But some carriers don't allow customers change APN directly. I did some more research and it seems that Android deprecated Settings.Secure.HTTP_PROXY in ICS with global_http_proxy_host but I could not find anything about it. Just posted another question on this. http://stackoverflow.com/questions/10611381/settings-secure-http-proxy-deprecated-in-ics-but-no-information-on-replacement – Safecoder May 16 '12 at 21:16
  • Check out this answer for some more details on Android's Proxy situation: http://stackoverflow.com/questions/10811698/getting-wifi-proxy-settings-in-android/13616054#13616054 – Adam Nov 28 '12 at 23:46
1

if the device is rooted. you can edit the Iptable

Changwei Yao
  • 13,051
  • 3
  • 25
  • 22