How can i set the System Port and Proxy? Is there any command in java that can do that? 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. 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");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.