说明:此代码可以判断当前设备是否正在使用代理联网
javags(SDK_INT, null, "android.os.Build$VERSION", "SDK_INT")
f(SDK_INT >= 14) {
java(address, null, "java.lang.System.getProperty", "String", "http.proxyHost")
java(port, null, "java.lang.System.getProperty", "String", "http.proxyPort")
f(port == null || port == "") {
s port = -1
} else {
java(port, null, "java.lang.Integer.parseInt", "String", port)
}
} else {
java(address, null, "android.net.Proxy.getHost", "Context", activity)
java(port, null, "android.net.Proxy.getPort", "Context", activity)
}
f(address == null || address == "" || port == -1) {
tw("没有使用代理")
} else {
tw("使用了代理")
}
评论