'androidx proxyconfig how to set user password authentication
how to add user password ? my proxy have authentication with user password code 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");
}
});
}
}
Solution 1:[1]
very easy to set user password proxy for http https proxy webview. String user = "xxxx" String password = "xxxx" But socks proxy can't work this way . Please help any one
myWebView.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
handler.proceed(user, password);
}
});
done !!!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |