通过Android中的Settings.Global撤消设置代理 [英] Undo setting proxy via Settings.Global in Android
本文介绍了通过Android中的Settings.Global撤消设置代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写系统应用,该应用通过以下方式设置全局http代理
I am writing system app, which sets global http proxy via
Settings.Global.putString(getContentResolver(), Settings.Global.HTTP_PROXY, "127.0.0.1");
如何还原此更改?
这不起作用:
How can I revert this change?
This don't work:
Settings.Global.putString(getContentResolver(), Settings.Global.HTTP_PROXY, null);
有什么想法吗?
预先感谢
Any ideas?
Thanks in advance
推荐答案
Andrews答案适用,但仅适用于有根设备,这是我针对无根设备的解决方案.
Andrews answer works but only for rooted devices, here's my solution for non-rooted devices.
我使用以下命令添加了代理:
I added the proxy with the following command:
adb shell settings put global http_proxy <ip>:<port>
更新:要删除它,可以使用以下命令(感谢Rohit Patel提供了此命令):
Update: To remove it you can use the following command (thanks to Rohit Patel for providing this):
adb shell settings put global http_proxy :0
要删除它,我使用了以下命令:
To remove it I used these commands:
adb shell settings delete global http_proxy
adb shell settings delete global global_http_proxy_host
adb shell settings delete global global_http_proxy_port
重新启动设备,您应该会很好
Restart the device and you should be good to go
这篇关于通过Android中的Settings.Global撤消设置代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文