Can I turn off the display of Google ads in WebView? I have disabled links
The mobile web page loaded on WebView
displays Google ads. However, the same ads are displayed inside the app. So there are too many ads.
I tried to catch all references containing googleads
both googlesyndication
in the method shouldOverrideUrlLoading
and convert them to ""
. It was successful in the sense that nothing happens when you click on Google Ad.
However, I am unable to block the image. I tried to catch the image and replace it with my image from assets
without any success. Worse, I can't actually see the images from Google Ads. They must have been hidden in his files .js
or something.
So now I have images with dead links.
Who managed to disable Google ad images in the same way?
The code looks like this:
WebViewClient webViewClient = new WebViewClient() {
Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains("googleads") || url.contains("googlesyndication")) {
url = "";
super.shouldOverrideUrlLoading(view, url);
return true;
}
NOTE. We need the client side for the next few months as the server side is not available.
source to share
No one has answered this question yet
Check out similar questions: