如何在 Android 手机中设置代理?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2011432/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I set a proxy in Android phones?
提问by tawfekov
Am really wondering how to set a proxy server in android phone like [tattoo] in order to gain access in some private networks
我真的很想知道如何在 [tattoo] 之类的 android 手机中设置代理服务器,以便在某些专用网络中获得访问权限
any suggestion would be appreciated ...
任何建议将不胜感激...
thanks
谢谢
采纳答案by tawfekov
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.
没有用于 android web 浏览器的代理设置的 UI。但是 android 网络浏览器将读取其设置数据库中的代理设置。以下是在 android 网络浏览器中启用代理的说明。
adb shell
sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db
sqlite> INSERT INTO system VALUES(99,'http_proxy', 'proxy:port');
sqlite>.exit
adb shell
sqlite3 /data/data/com.google.android.providers.settings/databases/settings.db
sqlite> INSERT INTO system VALUES(99,'http_proxy', 'proxy:port');
sqlite>.exit
source: http://discuz-android.blogspot.com/2008/01/set-proxy-for-android-web-browser.html
来源:http: //discuz-android.blogspot.com/2008/01/set-proxy-for-android-web-browser.html
回答by Oliver
For Android 4.0.3and up (don't know how far up though) the followingwill work:
对于Android 4.0.3及更高版本(虽然不知道有多远),以下内容将起作用:
- Go to Settings -> Wifi.
- Long-click on your network and select 'Modify network'.
- Scroll down to 'Show advanced options' which should show you the proxy options.
- Edit your proxy settings as desired and save.
- 转到设置 - > Wifi。
- 长按您的网络并选择“修改网络”。
- 向下滚动到“显示高级选项”,它会显示代理选项。
- 根据需要编辑您的代理设置并保存。
回答by Malcolm Crum
If you have ADB access, this should work:
如果您有 ADB 访问权限,这应该可以工作:
adb shell settings put global http_proxy <address>:<port>
adb shell settings put global http_proxy <address>:<port>
However the setting will be lost with a reboot.
但是,重新启动后该设置将丢失。
回答by BenC
On CyanogenMod (source : http://forum.cyanogenmod.com/topic/20002-web-proxy-setup/)
关于 CyanogenMod(来源:http: //forum.cyanogenmod.com/topic/20002-web-proxy-setup/)
In CM6 there was a setting in the Wireless & Settings for the proxy.
在 CM6 中,代理的无线和设置中有一个设置。
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
在 CM7 中,您必须长按桌面背景。然后在弹出的列表中选择Custom Shortcut
- Pick your activity
-
Activities
- Settings
- 这个长列表的底部是Proxy Settings
Add this shortcut to your desktop. When you then click on the shortcut you can enter your proxy address and port number.
将此快捷方式添加到您的桌面。当您然后单击快捷方式时,您可以输入您的代理地址和端口号。
回答by John
I found something herethat 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.
到您的清单。
回答by Ninad
Froyo has no provision for setting up proxy per wifi connection. In that case, you setup your wifi and install->setup ProxyDroid - http://www.appbrain.com/app/proxydroid/org.proxydroid
Froyo 没有为每个 wifi 连接设置代理的规定。在这种情况下,您设置 wifi 并安装->设置 ProxyDroid - http://www.appbrain.com/app/proxydroid/org.proxydroid
Let me know if it does not work.
如果它不起作用,请告诉我。
Needs your phone rooted.
需要你的手机植根。
回答by Samuh
You have to create Access Points which can then be configured with Proxy Settings for different provider networks.
Go to Home->Menu->Settings->WirelessControls->MobileNetworks->Access Point Names create an APN and configure it for what ever provider you want
您必须创建接入点,然后可以为不同的提供商网络配置代理设置。
去Home->Menu->Settings->WirelessControls->MobileNetworks->Access Point Names create an APN and configure it for what ever provider you want
Hope that helps..
希望有帮助..