You can decide to present the first layer or second layer as you deem necessary for your user experience. However, we recommend to:
Use the first layer when collecting consent for the first time. Remember that user's will be able to navigate from the first layer to the second layer.
Use the second layer for when customers want to review their choices. e.g. In your app's settings.
Presenting the first layer
import UsercentricsUI
let banner = UsercentricsBanner()
banner.showFirstLayer(hostView: self // Host UIViewController) { userResponse in
// Handle userResponse
}import com.usercentrics.sdk.ui.tv.BannerSettings
import com.usercentrics.sdk.ui.tv.UsercentricsBanner
val banner = UsercentricsBanner(
context = <Context>,
settings = <BannerSettings?>
)
banner.showFirstLayer { userResponse ->
// Handle userResponse
}Use a valid context
We are using the
DialogAndroid API for the banner implementation. It is recommended to use aContextthat is anActivityor derived/wrapper from it. Note that theActivityhas to be alive for the dialog to be displayed.
Presenting the second layer
import UsercentricsUI
let banner = UsercentricsBanner()
banner.showSecondLayer(hostView: self // Host UIViewController) { userResponse in
// Handle userResponse
}import com.usercentrics.sdk.ui.tv.BannerSettings
import com.usercentrics.sdk.ui.tv.UsercentricsBanner
val banner = UsercentricsBanner(
context = <Context>,
settings = <BannerSettings?>
)
banner.showSecondLayer { userResponse ->
// Handle userResponse
}Use a valid context
We are using the
DialogAndroid API for the banner implementation. It is recommended to use aContextthat is anActivityor derived/wrapper from it. Note that theActivityhas to be alive for the dialog to be displayed.
Handling user response
After a user provides their consent choices, you will receive a UsercentricsConsentUserResponse object in the banner presentation callback. This object will provide you with all the information you need in order to apply consent, make decisions based on the user's interaction or store the user's ControllerID if you wish to support Cross-Device Consent Sharing.