lib / tv.smartclip.smartclientandroid.lib.dto / SxConfiguration / clickThroughListener

clickThroughListener

var clickThroughListener: ((listener: (Boolean) -> Unit) -> Boolean)?

If defined and clickType is SxClickType.CLICKABLE_WITH_CONFIRMATION_DIALOG this method will be invoked when a user tapped on an advertisement. If you want the SDK to show the dialog to the user just return false in the listener. Example:

SxConfiguration.INSTREAM.apply {
    clickThroughListener = { callback ->
        ...
        false
    }
}

When returning true you are responsible for building and showing the dialog. You also have to forward the user selection with the provided callback lambda to the sdk. The media playback will be paused until the callback is invoked. Example:

SxConfiguration.INSTREAM.apply {
    clickThroughListener = { callback ->
        AlertDialog.Builder(context)
            .setTitle("Custom Click Through Dialog")
            .setMessage("Do you want to proceed?")
            .setPositiveButton("Yes") { _, _ -> callback(true) }
            .setNegativeButton("No") { _, _ -> callback(false) }
            .show()
        true
    }
}

Property

clickThroughListener -

If defined and clickType is SxClickType.CLICKABLE_WITH_CONFIRMATION_DIALOG this method will be invoked when a user tapped on an advertisement. If you want the SDK to show the dialog to the user just return false in the listener. Example:

SxConfiguration.INSTREAM.apply {
    clickThroughListener = { callback ->
        ...
        false
    }
}

When returning true you are responsible for building and showing the dialog. You also have to forward the user selection with the provided callback lambda to the sdk. The media playback will be paused until the callback is invoked. Example:

SxConfiguration.INSTREAM.apply {
    clickThroughListener = { callback ->
        AlertDialog.Builder(context)
            .setTitle("Custom Click Through Dialog")
            .setMessage("Do you want to proceed?")
            .setPositiveButton("Yes") { _, _ -> callback(true) }
            .setNegativeButton("No") { _, _ -> callback(false) }
            .show()
        true
    }
}