简体   繁体   English

Android SDK:系统设置

[英]Android SDK: System Setting

How can i set the System Port and Proxy? 如何设置系统端口和代理? Is there any command in java that can do that? Java中是否有任何命令可以做到这一点? If not, how can i change it with superuser permission? 如果没有,我如何在超级用户许可下进行更改? I have tryed a lot of codes, but no one worked for me. 我尝试了很多代码,但是没有人为我工作。 Please help. 请帮忙。

String myProxy=Proxy.getDefaultHost() ; 
        int myPort=Proxy.getDefaultPort(); 
        HttpHost proxy = new HttpHost(myProxy,myPort,"http"); 
        client.getParams().setParameter (ConnRoutePNames.DEFAULT_PROXY, proxy);  

try giving this within your java file. 尝试在您的Java文件中提供此名称。 before that change your proxy settings in emulator! 在此之前,请在模拟器中更改代理设置!

Note: This is not persistent. 注意:这不是持久性的。

System.setProperty("http.proxyHost", "192.x.x.x"); 
System.setProperty("http.proxyPort", "8080");
System.setProperty("http.proxyUser", "myuser"); 
System.setProperty("http.proxyPassword", "mypassword");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM