简体   繁体   中英

Using Proxy Server in Android Application

I am making an Android Application for giving PNR status to the input pnr using a json api. But as I am using institute wifi to access network for accessing internet from my android cell phone, so I had set up proxy using the conventional java lines

System.getProperties().put("http.proxyHost", "10.3.100.211");
System.getProperties().put("http.proxyPort", "8080");

But when I run the application it abruptly stops. If I comment out the lines the connection is not established but the application runs fine. So could someone help me in how to set up proxy in my application.

Try using:

  public static String setProperty (String name, String value)


  Sets the value of a particular system property.
  Returns the old value of the property or null if the property didn't exist. 

http://developer.android.com/reference/java/lang/System.html#setProperties%28java.util.Properties%29

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.

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