How can you set the http proxy programatically?
<p>I'm looking for a programmatic way to set-up http proxy settings for android handsets.  I've tried using android.provider.Settings.System.putString() to set System.HTTP_PROXY, but my call fails (I'm using a 2.2 emulator image at the moment). My code looks like:</p>

<pre><code>if (System.putString(getContentResolver(), System.HTTP_PROXY, "10.10.2.1:8080")) {
    tv.append("put for HTTP_PROXY succeeded.\n");
}
else {
    tv.append("put for HTTP_PROXY failed.\n");
}
</code></pre>

<p>I've also added to my android manifest:</p>

<pre><code>&lt;uses-permission android:name="android.permission.WRITE_SETTINGS" /&gt;
&lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /&gt;
</code></pre>

<p>..although it's not clear from the docs which permission, if any, is required.</p>

<p>I'm familiar with <a href="http://stackoverflow.com/questions/2011432/how-do-i-set-a-proxy-in-android-phones">this SO thread</a>, but the technique there requires manual adb commands, which require the SDK tools and (possibly) a rooted phone. </p>

<p>Is there a way to accomplish this? Ideally, I'd like away to set an http proxy that will be used for both data and wifi connections.</p>
