Reputation: 1397
I have implemented the URL whitelisting in the Android web view by using shouldOverrideUrlLoading
.
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
if (isAllowedUrl(request?.url)) {
return super.shouldOverrideUrlLoading(view, request)
}else{
// request external browser
return true
}
}
This could intercept all the URL redirects. Is there any way to intercept background API calls made by the website? Our website making some analytics calls. I want to conditionally allow/block these requests. Is it possible to intercept those requests in the Android web view?
The shouldInterceptRequest
can intercept all requests, but I couldn't find a way to block the request.
Upvotes: 0
Views: 342