As you read through the Privacy Sandbox on Android documentation, use the Developer Preview or Beta button to select the program version that you're working with, as instructions may vary.
Set up the Privacy Sandbox SDK
Follow the instructions on this page to set up the Privacy Sandbox on Android SDK in Android Studio.
Within Android Studio, install the SDK as follows:
- Install the latest Canary build or Stable build of Android Studio.
- In Android Studio, go to Tools > SDK Manager.
- In the SDK Platforms tab, select Android TiramisuPrivacySandbox Preview.
- In the SDK Tools tab, select Android SDK Build-Tools 33 or later.
- Click OK to install the SDK.
Declare the correct API levelsTo use the Privacy Sandbox on Android APIs, declare your app's compile API level and target API level as follows, based on your version of the Android Gradle plugin (AGP)
AGP 7.0.0 or higher:
compileSdkPreview "TiramisuPrivacySandbox" targetSdkPreview "TiramisuPrivacySandbox"
AGP 4.2.0 or lower:
compileSdkVersion "android-TiramisuPrivacySandbox" targetSdkVersion "android-TiramisuPrivacySandbox"
Get the Privacy Sandbox on Android on a supported device
After you complete the preceding setup steps, you can then test Privacy Sandbox on Android. See Configure a device or emulator image for more information.