Starting in Android 14, the Android package installer can ingest metadata about an app, such as data safety practices, for use in Android platform features such as the updated Location permission prompt.
There are two ways to provide this metadata:
For an app preloaded on the system image, device manufacturers can provide metadata about the app by adding an XML file to the system image with the persistable bundle described below.
For apps being installed or updated, To specify this metadata, app installers should pass a
PersistableBundleobject into thesetAppMetadata()method.
The top-level persistable bundle consists of the following key/values pairs. Unless specified otherwise, each key is optional.
version(required)- The version number of the app metadata format. Use
2as the value for this current version andlongas the type. If expected keys or content types ofAppMetadatachange, Android will change the version number. safety_labels- A
PersistableBundleobject that specifies the app's safety-labels. system_app_safety_label- A
PersistableBundleobject that specifies the app's system-app-safety-label. For apps acting as a system service, thesystem_app_safety_labelbundle is used instead of thesafety_labelsbundle. transparency_info- A
PersistableBundleobject that specifies the app's transparency information.
Safety labels format
The safety_labels bundle contains the following key/values pairs:
version(required)- The version number of the safety labels format. Use
1as the value for this current version andlongas the type. data_labels- A
PersistableBundleobject that specifies the data that the app collects and shares. security_labels- A
PersistableBundleobject that specifies the app's data deletion and encryption practices. third_party_verification- A
PersistableBundleobject that specifies how the app's data safety practices are verified by a third party.
Data collected and shared
The data_labels bundle contains the following key/value pairs:
data_collected- A
PersistableBundleobject that specifies the types of data that the app collects. data_shared- A
PersistableBundleobject that specifies the types of data that the app shares.
Data categories
Both the data_collected and data_shared keys use the data_category bundle
format, which contains the key/value pairs shown in the following list. Each key
maps to a PersistableBundle object that specifies the data types for a
particular category.
personalfinanciallocationemail_text_messagephoto_videoaudiostoragehealth_fitnesscontactscalendaridentifiersapp_performanceactions_in_appsearch_and_browsing
Data types
Each key in the data_category bundle maps to a different bundle that uses the
data_type format. The keys that you specify in the data_type format depend
on what you choose for a data_category.
The possible data_type key/value pairs appear in the following lists. The
value for each of these keys is a PersistableBundle object that describes the
app's data usage practices for that particular data type. Some data types
use only one key.
Personal
nameemail_addressphysical_addressphone_numberrace_ethnicitypolitical_or_religious_beliefssexual_orientation_or_gender_identitypersonal_identifiersother
Financial
card_bank_accountpurchase_historycredit_scoreother
Location
approx_locationprecise_location
Email and text messages
emailstext_messagesother
Photos and videos
photosvideos
Audio
sound_recordingsmusic_filesother
Storage
files_docs
Health fitness
healthfitness
Contacts
contacts
Calendar
calendar
Identifiers
other
App performance
crash_logsperformance_diagnosticsother
Actions in app
user_interactionin_app_search_historyinstalled_appsuser_generated_contentother
Search and browsing
web_browsing_history
Data usage
The data_usage bundle contains the following key/value pairs:
purposes(required)-
An array of integers that represents specific reasons for collecting or sharing data and uses
PersistableBundleputIntArraymethod. At least one of the purposes defined below are required for each bundle.1: PURPOSE_APP_FUNCTIONALITY2: PURPOSE_ANALYTICS3: PURPOSE_DEVELOPER_COMMUNICATIONS4: PURPOSE_FRAUD_PREVENTION_SECURITY5: PURPOSE_ADVERTISING6: PURPOSE_PERSONALIZATION7: PURPOSE_ACCOUNT_MANAGEMENT
is_collection_optional-
Boolean value. Specifies whether users can opt in to, or opt out of, data collection.
Note: Set this value only for
data_categorybundles that represent data collection; don't set it for data sharing. ephemeral-
Boolean value. Specifies whether the app processes the data server-side only in memory, not on disk, and that the app retains the data no longer than necessary to service the specific data processing request.
Note: Set this value only for
data_categorybundles that represent data collection; don't set it for data sharing.
Data deletion and encryption practices
The security_labels bundle contains key/value pairs that represent the app's
data deletion and encryption practices:
is_data_deletable- Boolean value. Specifies whether or not the app allows the user to request the app to delete their user data.
is_data_encrypted- Boolean value. Specifies whether or not all user data collected by the app is encrypted in transit.
Third-party verification
The third_party_verification bundle consists of a single key, url. This URL,
represented as a string value, specifies the third-party website used for
verifying the app's data safety information.
System service safety labels format
For apps acting as a system service, the system_app_safety_label bundle
is used instead of the safety_labels bundle and contains the following
key/values pairs:
url (required)
- URL that points to a page containing safety information for the app that is acting as a system service.
- Use
stringas the type. - If it has not been supplied then the privacy policy URL should be used as a fallback.
- Note: The Google Play store uses
privacy_policyas a fallback.
Transparency info format
The transparency_info bundle contains the following key/values pairs:
developer_info- A
PersistableBundleobject that specifies information about the app developer. app_info- A
PersistableBundleobject that specifies information about the app.
Developer info
The developer_info bundle contains the following key/value pairs:
developer_#- A
PersistableBundleobject that identifies the developer. Thedeveloper_infocontains one or moredeveloper_#, where#is an integer. For exampledeveloper_0,developer_1,developer_2, and so on.
Developer
The developer_# bundle contains the following key/value
pairs:
name(required)- A string that states the name of the developer.
email(required)- A string that states the email address of the developer.
address(required)- A string that states the mailing address of the developer.
country_region(required)- A string that states the country or region of the developer.
website- A string that states the website of the developer.
app_registry
- A string that states the store or registry of the developer.
- If the developer is also registered on a store or other registry, the value should be the Android package name of the store or the URL of the registry.
- Multiple entries for multiple stores are permitted.
- For Google Play, use
com.android.vending. - If the developer is an SDK listed in the Google Play SDK Index, omit this attribute.
- If a developer isn't registered on any app store or registry, omit this attribute.
app_registry_id
- A string that states the ID of the developer for the stated
app_registry. - If the developer is also registered on a store or other registry, the value should be their store or registry identity.
- Multiple entries for multiple stores are permitted.
- For developers registered with Google Play, this value must be the URL of the developer page (for example, https://play.google.com/store/apps/dev?id=5700313618786177705 is the URL for developer Google LLC).
- If the developer is a SDK developer listed in the Google Play SDK Index, use the Google Play SDK Index URL of the SDK (for example, https://play.google.com/sdks/details/com-google-android-gms-play-services-ads is the Google Play SDK Index URL of Google Mobile Ads (GMA) SDK).
- If the developer is registered on another store or registry, an app store URL or other identifier can be provided.
- If a developer isn't registered on any app store, this attribute can be omitted.
App info
The app_info bundle contains the following key/value pairs:
title(required)- A string that states the title of the app.
description(required)- A string that states the purpose of the app in a human-readable blob of text in English.
contains_ads(required)- A boolean that declares whether the app displays any ads.
privacy_policy (required)
- A string that contains a URL attribute linking to the privacy policy detailing how user data is handled.
- Required for apps that transmit user data.
- If the app doesn't contain this link, it is assumed that the app does not handle user data.
category(required)A string that contains one of the following app categories that best describes the app's primary purpose:
- Android (only for an AOSP component)*
- Art and design
- Cars and vehicles
- Beauty
- Books and reference
- Business
- Comics
- Communications
- Dating
- Education
- Entertainment
- Events
- Finance
- Food and drink
- Game
- Health and fitness
- House and home
- Installer (only for an app store or other installer)*
- Libraries and demo
- Lifestyle
- Maps and navigation
- Medical
- Music and audio
- News and magazines
- Parenting
- Personalisation
- Photography
- Productivity
- Security*
- Shopping
- Social
- Sports
- Tools
- Travel and local
- Updater (only for a device's default over-the-air (OTA) update app)*
- Video players and editors
- Weather
contact_info- A
PersistableBundleobject that includes contact information for the app (below).
Contact info
The contact_info bundle contains the following key/value pairs:
email(required)- A string that states the email address for the app.
website- A string that states the website for the app.