繁体   English   中英

在Android应用程序中使用代理服务器

[英]Using Proxy Server in Android Application

我正在制作一个Android应用程序,使用json API将PNR状态赋予输入pnr。 但是由于我使用学院wifi来访问网络以从我的android手机访问互联网,因此我已经使用常规的java行设置了代理

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

但是,当我运行该应用程序时,它突然停止了。 如果我注释掉这些行,则表示未建立连接,但应用程序运行良好。 因此有人可以帮助我如何在我的应用程序中设置代理。

尝试使用:

  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

暂无
暂无

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

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