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
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.
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
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:
false to activate:
adb shell device_config put adservices global_kill_switch false
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:
- You should receive an email from Privacy Sandbox Support with your enrollment account ID and a URL that points to the enrollment file.
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>"
(Optional but recommended) Verify override returns the path set in the previous step.
adb shell device_config get adservices mdd_measurement_manifest_file_url
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.
Force run the download job.
adb shell cmd jobscheduler run -f com.google.android.adservices.api 14
You can now start calling the Privacy Preserving APIs in Developer Preview. The call you made in Step 4 should now succeed.
In Developer Preview releases, you can access Protected Audience and Topics APIs
without enrolling by running the following enrollment deactivation
adb shell setprop debug.adservices.disable_fledge_enrollment_check true
adb shell setprop debug.adservices.disable_topics_enrollment_check true
adb shell device_config put adservices disable_measurement_enrollment_check "true"
Recommended for you
- Release notes
- Attribution reporting: cross app and web measurement
- Support custom audience targeting with the Protected Audience API