Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.57 KB

README.md

File metadata and controls

36 lines (23 loc) · 1.57 KB

Didomi - Android Sample App (Kotlin)

Description

This sample app demonstrates how to implement Didomi in a simple Android Studio project using Kotlin.

In particular, it shows how to:

  • Condition a custom vendor to consent
  • Open the Preferences
  • Share consent with a web view

This app is also using the Google Mobile Ads SDK as we are taking Google Advertising Products as an example of a commonly used IAB vendor.

Main Content

MainApplication.kt

  • Initialize the Didomi SDK.
  • Initialize the Google Mobile Ads SDK. The consent status is shared with Google automatically as it is an IAB vendor.
  • Condition a custom vendor to consent. We initialize it if and only if it is enabled.

MainActivity.kt

Here we define the actions of the buttons of our UI:

  • Show the preferences (purposes).
  • Show the preferences (vendors).
  • Show a web view.
  • Show an ad.

WebViewActivity.kt

  • Load a WebView and share consent with it. You need to embed the Didomi Web SDK in the HTML page that is loaded by the web view so that it can collect the consent information passed from the app and share it with vendors. The list of vendors configured in the web SDK in the web view should be a subset of the list of vendors configured in the mobile app. That will ensure that the WebView has all the consent information it needs and does not re-collect consent. See Share consent with WebViews.

CustomVendor.kt

  • Implement a basic CustomVendor class with an initialize() method to simulate our custom vendor's SDK.