0

I searched it over the internet and found this link. I followed it but it didn't work. So I looked at logcat which told me this:

Setting http_proxy has moved from android.provider.Settings.System to android.provider.Settings.Secure, value is unchanged.

So I added

<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />

to the menifest and in my code, I changed to

Settings.System.putString(getContentResolver(), Settings.Secure.HTTP_PROXY, "127.0.0.1:8080");//enable proxy

and

Settings.System.putString(getContentResolver(), Settings.Secure.HTTP_PROXY, "");//disable proxy

but still I get the same setting moved error. What am I missing?

I saw the question How can I get the dreaded WRITE_SECURE_SETTINGS permission for my android app? also which says I can't get this permission. Is that true? And come on, I'm just changing proxy setting! Why am I not allowed to do so? At least, can I direct user to somewhere he can himself change proxy, like we do for enabling bluetooth?

Community
  • 1
  • 1
prongs
  • 9,422
  • 21
  • 67
  • 105
  • DNS resolving doesn't work behind a proxy. http://code.google.com/p/android/issues/detail?id=2764. from this link http://www.vogella.de/articles/AndroidNetworking/article.html – Aditya Apr 02 '12 at 10:03
  • @Aditya: seems like that issue was for android 1.5. They must have resolved it till now. – prongs Apr 02 '12 at 10:06
  • It was still Open Issue. Similarly there is an issue with WiFi http://code.google.com/p/android/issues/detail?id=1273 Android seem to have some PROXY issues !!! – Aditya Apr 02 '12 at 10:25

1 Answers1

0

You are calling Settings.System.putString() instead of Settings.Secure.putString(). The String name passed in is usually "http_proxy" in both cases, the difference is you want to save to the Secure class' database.

SimonM
  • 1