Display backfill ads in your WebView by registering it with the Adrop SDK. This allows web content within your app to show ads through the Adrop platform.
import android.webkit.WebViewimport io.adrop.ads.Adropclass WebViewActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val webView = findViewById<WebView>(R.id.webView) // Register WebView for backfill ads support // Call as early as possible, before loading content Adrop.registerWebView(webView) // Load your web content webView.loadUrl("https://your-website.com") }}
If your app opens non-own-domain URLs in an external browser, you must ensure that ad resource requests (e.g., googleads.g.doubleclick.net) are not blocked.Ad resources such as iframes and scripts are loaded automatically by the ad SDK — they are not user-initiated navigations. Only redirect user-initiated main frame navigations to an external browser.
import android.content.Intentimport android.net.Uriimport android.webkit.WebResourceRequestimport android.webkit.WebViewimport android.webkit.WebViewClientval allowedHost = "my-domain.com"webView.webViewClient = object : WebViewClient() { override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean { val url = request.url val host = url.host ?: "" // Only redirect user-initiated navigations to external browser // Ad resources (e.g., googleads.g.doubleclick.net) load via iframes/scripts, // not user gestures — do not block them if (!host.contains(allowedHost) && request.hasGesture()) { view.context.startActivity(Intent(Intent.ACTION_VIEW, url)) return true } return false }}
Do not block or redirect all non-own-domain requests. Ad resources like googleads.g.doubleclick.net are loaded automatically during the backfill ad process and must be allowed to load within the WebView.