Skip to content

MonsterTechnoGits/WebViewAdblock-Library

Repository files navigation

Discover WebViewAdblock: Your Ultimate Solution for Ad-Free Android WebView Experience

WebViewAdblock empowers you to effortlessly block ads within your Android WebView, ensuring an uninterrupted browsing experience. Eliminate distractions and enhance user engagement by seamlessly intercepting ad requests and removing their HTML content.

WebViewAdblock

Simple Integration in 4 Steps

Step 1: Add Repository

Integrate WebViewAdblock by adding the repository to your project's build.gradle:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2: Include Dependency

Incorporate the WebViewAdblock dependency in your app's build.gradle:

dependencies {
    implementation 'com.github.MonsterTechnoGits:WebViewAdblock:1.2'
}

Step 3: Initialize WebView

Initialize WebView within your activity containing the WebView:

new AdBlockerWebView.init(this).initializeWebView(webView);

Step 4: Implement Ad Blocking

Extend WebViewClient for your WebView and override methods to enable ad blocking:

webView.setWebViewClient(new Browser_home());

private class Browser_home extends WebViewClient {

    Browser_home() {}

    @SuppressWarnings("deprecation")
    @Override
    public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
        return AdBlockerWebView.blockAds(view,url) ? AdBlocker.createEmptyResource() :
                super.shouldInterceptRequest(view, url);
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
        if (AdBlocker.isAd(request.getUrl().toString())) {
            // Block the ad by returning true
            return true;
        } else {
            // Allow regular URLs to load
            return false;
        }
    }
}

Seamless, Ad-Free Browsing

With WebViewAdblock, enjoy a distraction-free browsing experience on your Android WebView. Enhance user satisfaction and engagement while maintaining control over your WebView environment.

Start Your Ad-Free Journey Now!

Take control of ad intrusion and elevate user experience with WebViewAdblock. Enjoy seamless browsing without distractions. Integrate WebViewAdblock into your project today and offer users an ad-free journey.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages