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.

+3
android webview adsense


source to share


No one has answered this question yet

Check out similar questions:

1832
Lazy loading images in ListView
86
Android Webview - Clear Cache Completely
15
Don't navigate to other pages in the WebView, disable links and links
eleven
Has the default Android WebView behavior changed to open inside all links?
ten
How to get Webview iframe link to launch browser?
3
Android - webview - shouldOverrideUrlLoading not called - when user clicks links inside iframe
2
Unable to get the current url of the HTML page of webpages when the page has changed from Cordova android developer app
1
Webview ShouldOverrideUrlLoading not being called
1
WebView links not opening
0
Android progress bar inside WebView



All Articles
Loading...
X
Show
Funny
Dev
Pics