Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set a proxy in Android phones?

Tags:

android

Am really wondering how to set a proxy server in android phone like [tattoo] in order to gain access in some private networks

any suggestion would be appreciated ...

thanks

like image 218
tawfekov Avatar asked Jan 06 '10 07:01

tawfekov


People also ask

Can I use Proxy on android?

Android allows you to configure proxy settings for each Wi-Fi network. This is sometimes required to access the Internet on a business or school network, for example. Your browser traffic will be sent through the proxy you configure.

What does Proxy mean on android?

A proxy server is a server which is known as an application gateway which acts as an intermediary between the local network and large scale network such as the internet. We can configure our proxy settings over Wi-Fi network on android device.

What is Proxy in APN settings?

The Proxy and Port fields are optional fields allowing you to specify the address of a HTTP proxy to use for all web traffic over this connection. Carriers sometimes use HTTP proxies to modify websites for your device, or to improve the speed of commonly access web pages and resources by caching them.


5 Answers

Finally i got what i want and here is the result :

There is no UI for proxy settings for android web browser. But the android web browser will read the proxy settings in its settings database. Here is the instructions to enable the proxy in the android web browser.

  1. adb shell
  2. sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db
  3. sqlite> INSERT INTO system VALUES(99,'http_proxy', 'proxy:port');
  4. sqlite>.exit

source: http://discuz-android.blogspot.com/2008/01/set-proxy-for-android-web-browser.html

like image 110
tawfekov Avatar answered Oct 08 '22 05:10

tawfekov


For Android 4.0.3 and up (don't know how far up though) the following will work:

  1. Go to Settings -> Wifi.
  2. Long-click on your network and select 'Modify network'.
  3. Scroll down to 'Show advanced options' which should show you the proxy options.
  4. Edit your proxy settings as desired and save.
like image 41
Oliver Avatar answered Oct 08 '22 05:10

Oliver


If you have ADB access, this should work:

adb shell settings put global http_proxy <address>:<port>

However the setting will be lost with a reboot.

like image 44
Malcolm Crum Avatar answered Oct 08 '22 06:10

Malcolm Crum


On CyanogenMod (source : http://forum.cyanogenmod.com/topic/20002-web-proxy-setup/)

In CM6 there was a setting in the Wireless & Settings for the proxy.

In CM7 you have to long press on the desktop background. Then in the list that pops up select Custom Shortcut - Pick your activity - Activities - Settings - toward the bottom of this long list is Proxy Settings

Add this shortcut to your desktop. When you then click on the shortcut you can enter your proxy address and port number.

like image 37
BenC Avatar answered Oct 08 '22 06:10

BenC


I found something here that looks like it might work

package com.BrowserSettings;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.provider.Settings;

public class BrowserSettingsUI extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final Button button = (Button) findViewById(R.id.Button01);
        button.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                try {
                    Settings.System.putString(getContentResolver(),  
            Settings.System.HTTP_PROXY, "127.0.0.1:100");//enable proxy
                }catch (Exception ex){
                }
            }
        });

        final Button button2 = (Button) findViewById(R.id.Button02);
        button2.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                try {
                    Settings.System.putString(getContentResolver(), 
            Settings.System.HTTP_PROXY, "");//disable proxy
                }catch (Exception ex){
                }
            }
        });
    }
}

You must add

<uses-permission android:name=”android.permission.WRITE_SETTINGS” />

to your manifest.

like image 20
John Avatar answered Oct 08 '22 04:10

John