TargetURLHandler

The interface of object responsible for processing the URL that the SDK wants to open in the browser.

You can create an object of this interface and pass it into AdService.makeAdvertisement in cases where you want to override the default URL handling behaviour.

This can be useful, for example, if you want to open a browser inside the application instead of opening an external one, or if you want to modify the URL before opening it.

class TargetURLHandlerExample() : TargetURLHandlerInterface {
override fun isValidURL(url: String): Boolean {
// Validate URL somehow
return true
}

override fun handleURL(url: String) {
// Handle URL somehow. For example, open a browser inside the application.
}
}
...

val result = AdService.makeAdvertisement(
AdRequest(contentUnit = CONTENT_UNIT),
targetURLHandler = TargetURLHandlerExample()
)

Functions

Link copied to clipboard
abstract fun handleURL(url: String)

A method for processing an URL that should be opened in the browser.

Link copied to clipboard
open fun isValidURL(url: String): Boolean

A method to validate an URL before opening in browser.