Is it possible to use okHttp as the webviewclient?
ie mWebView.setWebViewClient(new OkHttpClient());
This gives me an error...
The method setWebViewClient(WebViewClient) in the type WebView is not applicable for the arguments (OkHttpClient)
Any suggestions?
OkHttp Query Parameters ExampleBuilder urlBuilder = HttpUrl. parse("https://httpbin.org/get).newBuilder(); urlBuilder. addQueryParameter("website", "www.journaldev.com"); urlBuilder. addQueryParameter("tutorials", "android"); String url = urlBuilder.
OkHttp is an HTTP client from Square for Java and Android applications. It's designed to load resources faster and save bandwidth. OkHttp is widely used in open-source projects and is the backbone of libraries like Retrofit, Picasso, and many others.
OkHttp doesn't currently offer asynchronous APIs to receive a response body in parts.
The WebView doesn't support switching out network stacks if that's what you're asking. Depending on the version it uses a snapshot of the Chrome network stack or for pre-HC devices the WebKit network stack.
Theoretically you could hook up OkHttp via shouldInterceptRequest but I don't recommend doing that - you'll have no way of passing headers to the WebView, you'll have to extract and send cookies manually and it will almost certainly be slower since pre-KK WebView only reads one intercepted request at a time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With