문제

프로그래밍 방식으로 WiFi-Proxy 설정을 어떻게 읽을 수 있습니까?

Galaxys 및 GalaxyTab은 OS 레벨의 WiFi 연결을 특별히 특별히 HTTP 프록시 설정을 갖습니다. (메뉴 -> 설정 -> 무선 및 네트워크 -> Wi-Fi 설정 -> 메뉴 키가 있고 고급) 그렇지 않으면 매우 멋진 기능입니다. 그렇지 않으면 Wi-Fi에서 프록시 서버를 사용할 수 없습니다. (이슈 http://code.google.com/android. / 문제 / 세부 사항? ID= 1273 )

이제 내 응용 프로그램은 일반적인 HTTPClient와 HTTP 연결을 사용합니다. 나는 OS에서 프록시 설정을 읽고 연결에 넣지 만 어떻게 읽는 방법을 모릅니다.

getProp 명령을 사용하면 APN에 대한 프록시 설정을 읽을 수 있지만 Wi-Fi는 아닙니다. APN 프록시 설정은 "net.gprs.http-proxy"키와 함께 저장됩니다.

adb -d shell
$ getprop net.gprs.http-proxy
getprop net.gprs.http-proxy
http://proxy.example.com:8888/
$
.

WiFi 화면의 고급 설정은 com.android.settings.wifi.AdvancedSettings 및 자연스럽게 구현되며, 기본 설정은 /data/data/com.android.settings/shared_prefs/com.android.settings_preferences.xml에 저장됩니다. ...에 내 응용 프로그램에서 파일을 읽을 수 없습니다.

Samsung이 특별한 API를 설정하여 설정에 액세스 할 수 없지만 그러한 정보를 찾을 수 없으면 나는 멈추지 않는 것 같습니다. BTW, 광산을 포함한 많은 응용 프로그램은 글로벌 HTTP 프록시 설정으로 큰 장점을 가지므로 방법이 있기를 바랍니다 ...

도움이 되었습니까?

해결책

Future versions of android won't use net.gprs.http-proxy. They will instead use the java VM properties http.proxyHost, http.proxyPort and http.nonProxyHosts (https also set). Most http stacks are already compliant with this standard so you don't need to do extra work as an app developer.

The proxy settings will be read from the APN db (as it used to be) but will also be read from a per-wifi-AP db, so both wifi and mobile data will benefit.

This is in place in HC and beyond. If you want to check your proxy settings you can just use the System.getProperty("http.proxyHost") java call.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top