Sample App

Overview

Once you have downloaded the Native SDK scripts from the OneTrust application, you can begin testing in a demo application simulator using the files in the SDK package. To download the demo app, follow these steps. For more information on how to publish SDKs, see Publishing the Mobile App Consent SDKs.

To open the SDK files

  1. Extract the .zip file downloaded from the Admin UI. Folder hierarchy will be presented as in the screenshot below:
  1. In Android Studio, open the build.gradle document located within the gradle file in the OTPublishersNativeApp folder.
  1. Go to the Device Manager and select Create Virtual Device.
  1. Define the resolution for your device and configure the rest of settings clicking Next. When customized, click Finish.
Android TV example

Android TV example

  1. Choose the virtual device that you have configured on the Devices list and click the Play button.

To run the app

  1. Wait for the Simulator to load then navigate to the Settings view.
Android Mobile

Android Mobile

Android TV

Android TV

  1. Complete the fields, as follows:
FieldDescription
Domain URLCDN location for the SDK data. For more information, see Domain URL by Environment below.
Domain IDApplication ID for your app. Navigate to Mobile App Consent > SDKs > Your App > Instructions in your tenant to find this information.
LanguageYour two-letter or four-letter ISO language code. For example, en or en-GB for English.
Country CodeOptional two-letter ISO country code. For example,US for United States or FR for France, etc.
Region CodeOptional two-letter ISO region code most commonly used for US states like CA for California.
Data Subject IdentifierOptional data subject identifier value used to store a user's consent profile in OneTrust for metrics, reporting, audit, and cross device profile syncing. If no ID is specified, the SDK generates a random GUID.

📘

Domain URL by Environment

The value of the Domain URL field is determined based on your tenant's environment. Use the following table to identify the correct value.

EnvironmentDomain URL to Use
app.cookiepro.comcookie-cdn.cookiepro.com
app-uk.onetrust.comcdn-ukwest.onetrust.com
app-au.onetrust.comcdn-au.onetrust.com
app-apac.onetrust.comcdn-apac.onetrust.com
app.onetrust.comcdn.cookielaw.org
app-de.onetrust.comcdn.cookielaw.org
app-eu.onetrust.comcdn.cookielaw.org
trial.onetrust.comcdn.cookielaw.org
uat.onetrust.comcdn.cookielaw.org
uat-de.onetrust.comcdn.cookielaw.org

📘

Language Support

Translated language text depends on your template's settings managed on the OneTrust tenant. OneTrust provides default template text that is pre-translated across many languages. When you change the default template text, you will also need to setup the languages you wish to support and the translation text you wish to show. Otherwise, English text will be provided regardless of the language code provided.

  1. Click the Download SDK Data button. The SDK data will download to the demo application.
  2. By returning to the Home screen, you can then select Show Banner or Show Preference Center to see how the Native SDK will display consent preferences for the application.