FLEDGE is now Protected Audience. Learn more!

Configure devices to use Privacy Sandbox on Android

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.

Display the Privacy Sandbox user control UI

Privacy Sandbox on Android allows device users to control whether the Privacy-Preserving APIs (PPAPI) and the SDK Runtime are enabled on their own devices, or not. As of Developer Preview 5, the setting to display the user control UI is deactivated by default. For development and test purposes, you may want to enable the user control UI. To enable the user control UI, use the following adb command:

adb shell am start -n com.google.android.adservices.api/com.android.adservices.ui.settings.AdServicesSettingsActivity

By default, the user control is deactivated on the device. To enable the Privacy Sandbox API and SDK Runtime on the device, tap the toggle switch.

Figure 1. Privacy Sandbox user control UI on Android device.

Enable the Privacy Sandbox on the device

While the previous section enabled the device user to choose whether they wanted Privacy Sandbox running on their device, this section explains how a developer can enable the APIs on a device using adb commands.

Enable the PPAPI on the device

Enable the PPAPI

adb shell device_config put adservices ppapi_app_allow_list \"\*\"
adb shell device_config put adservices ppapi_app_signature_allow_list \"\*\"
adb shell device_config put adservices adservice_system_service_enabled true
adb shell device_config put adservices adservice_enabled true
adb shell device_config put adservices adservice_enable_status true

Deactivate the PPAPI

For development and test purposes, you can activate or deactivate PPAPI access on the device by running the following commands:

Set to false to activate:

adb shell device_config put adservices global_kill_switch false

Set to true to deactivate:

adb shell device_config put adservices global_kill_switch true

Enable the SDK Runtime on the device

adb shell device_config put adservices disable_sdk_sandbox false

Post enrollment steps

Once you've completed enrollment, there are a few additional steps you need to take to prepare your device to use the Privacy Sandbox APIs.

You need to force download the enrollment file onto your device with these steps:

  1. You should receive an email from Privacy Sandbox Support with your enrollment account ID and a URL that points to the enrollment file.
  2. On your device running the Developer Preview release, override the enrollment list using this command.

    adb shell device_config put adservices mdd_measurement_manifest_file_url
    "<insert URL provided>"
  3. (Optional but recommended) Verify override returns the path set in the previous step.

    adb shell device_config get adservices mdd_measurement_manifest_file_url
  4. Trigger an API call from one of the Privacy Preserving APIs. (e.g. registerSource() from the Attribution Reporting API, getTopics() from the Topics API, or joinCustomAudience() from the Protected Audience API). This call is expected to fail.

  5. Force run the download job.

    adb shell cmd jobscheduler run -f com.google.android.adservices.api  14
  6. You can now start calling the Privacy Preserving APIs in Developer Preview. The call you made in Step 4 should now succeed.

Deactivate enrollment

In Developer Preview releases, you can access Protected Audience and Topics APIs without enrolling by running the following enrollment deactivation adb commands. Enrollment is required for the Attribution Reporting API.

Protected Audience

adb shell setprop debug.adservices.disable_fledge_enrollment_check true


adb shell setprop debug.adservices.disable_topics_enrollment_check true