androidx proxyconfig如何设置用户密码认证
androidx proxyconfig how to set user password authentication
如何添加用户密码?我的代理使用用户密码进行身份验证
代码 androidx.webkit:1.4.0
//my code need to add user password
public void setProxy(){
if(WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE)) {
ProxyConfig proxyConfig = new ProxyConfig.Builder()
. addProxyRule("123.123.123.123:8080")
. addDirect().build();
ProxyController.getInstance().setProxyOverride(proxyConfig, new Executor() {
@Override
public void execute(Runnable command) {
//do nothing
}
}, new Runnable() {
@Override
public void run() {
Log.w(TAG, "WebView");
}
});
}
}
非常容易为 http https 代理 webview 设置用户密码代理。
字符串用户 = "xxxx"
字符串密码 = "xxxx"
但是 socks 代理不能这样工作。请帮助任何人
myWebView.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
handler.proceed(user, password);
}
});
完成!!!
如何添加用户密码?我的代理使用用户密码进行身份验证 代码 androidx.webkit:1.4.0
//my code need to add user password
public void setProxy(){
if(WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE)) {
ProxyConfig proxyConfig = new ProxyConfig.Builder()
. addProxyRule("123.123.123.123:8080")
. addDirect().build();
ProxyController.getInstance().setProxyOverride(proxyConfig, new Executor() {
@Override
public void execute(Runnable command) {
//do nothing
}
}, new Runnable() {
@Override
public void run() {
Log.w(TAG, "WebView");
}
});
}
}
非常容易为 http https 代理 webview 设置用户密码代理。 字符串用户 = "xxxx" 字符串密码 = "xxxx" 但是 socks 代理不能这样工作。请帮助任何人
myWebView.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
handler.proceed(user, password);
}
});
完成!!!