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.
Integrate WebViewAdblock by adding the repository to your project's build.gradle
:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Incorporate the WebViewAdblock dependency in your app's build.gradle
:
dependencies {
implementation 'com.github.MonsterTechnoGits:WebViewAdblock:1.2'
}
Initialize WebView within your activity containing the WebView:
new AdBlockerWebView.init(this).initializeWebView(webView);
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;
}
}
}
With WebViewAdblock, enjoy a distraction-free browsing experience on your Android WebView. Enhance user satisfaction and engagement while maintaining control over your WebView environment.
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.