[英]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.