Companion device profile, introduced in Android 12, is a feature that allows companion apps to request a set of permissions specific to the type of the companion device, for example, a smartwatch. Using a companion device profile simplifies the enrollment process by allowing apps to display a single prompt to users on their mobile devices to request a defined set of permissions instead of multiple prompts requesting permissions individually. This can allow for a more streamlined setup experience and better opt-in rates for companion apps.
To use companion device profiles, companion apps must meet the following requirements:
- Manage a companion device (for example, a smartwatch).
- Have app features or call Android APIs that require all the permissions defined for the companion device profile.
Each companion device profile corresponds to an Android role. For more information about the permissions and corresponding Android role of each profile, see companion device profiles for third-party apps.
For more information about companion devices, see Companion device pairing.
Device behavior
This section describes device behavior when companion device profiles are used.
When a user accepts an app's request to create an association with a companion
device, the
CompanionDeviceManager
(CDM) service assigns the device profile role (for example, watch) to the
companion
app, granting all the permissions defined for that specified profile role.
Figure 1 shows an example of an app requesting permissions for the
COMPANION_DEVICE_WATCH
device profile.
Figure 1. Dialog requesting permissions for the watch device profile.
When a user clears the package data in Settings or removes all devices in the companion app, CDM revokes the profile while the app isn't running in the foreground nor has a foreground service running. Revoking the profile also revokes all defined permissions for the profile.
After a user accepts an app's request to grant permissions for a particular device profile, the user can revoke individual permissions that were granted. When a permission is revoked by a user, the app remains associated with the companion device but certain features might become unavailable. If the permission is required for the app to function, the app must request the permission through a normal permission request.
Companion device profiles for third-party apps
Watch profile
The watch profile is introduced in Android 12.
The following table describes the defined permissions for the
COMPANION_DEVICE_WATCH
device profile and the requirements for using them.
Permissions | Companion app and device requirements |
---|---|
Benachrichtigungen
BIND_NOTIFICATION_LISTENER_SERVICE
POST_NOTIFICATIONS (added in Android 15) |
|
Telefon |
|
SMS |
|
Contacts |
|
Calendar |
|
Nearby devices |
|
eSIM provisioning |
|
Managing ongoing calls |
|
Glasses profile
The Glasses profile is introduced in Android 14.
The following table describes the defined permissions for the
COMPANION_DEVICE_GLASSES
device profile and the requirements for using them.
Permissions | Companion app and device requirements |
---|---|
BenachrichtigungenBIND_NOTIFICATION_LISTENER_SERVICE POST_NOTIFICATIONS |
|
Telefon |
|
SMS |
|
Contacts |
|
Microphone |
|
Nearby devices |
|
Managing ongoing calls |
|
Implementation
For third-party developers implementing a companion app that requests the
DEVICE_PROFILE_WATCH
profile, do the following:
Call the
setDeviceProfile
method.Pass in a profile (for example,
DEVICE_PROFILE_WATCH
when buildingAssociationRequest
.
Device manufactures to skip displaying the user consent dialog
For device manufacturers implementing a companion app with a specific device, use the following required Android system configs to certify the companion app, which allows the app to skip displaying the user consent dialog for users.
Retrieve the certificate using the following command:
keytool -printcert -jarfile PATH/TO/APK
Replace the package name and certificate as shown in the following sample input in the config file:
<!-- A list of packages managing companion device(s) by the same manufacturers as the main device. It will not create the association without prompting if the association has been called multiple times in a short period. Note that config_companionDeviceManagerPackage and config_companionDeviceCerts are parallel arrays. --> <string-array name="config_companionDevicePackages" translatable="false"> <item>YOUR_COMPANION_APP_PACKAGE_NAME</item> </string-array> <!-- A list of SHA256 Certificates managing companion device(s) by the same manufacturers as the main device. It will fall back to showing a prompt if the association has been called multiple times in a short period. Note that config_companionDeviceCerts and config_companionDeviceManagerPackage are parallel arrays. Example: "1A:2B:3C:4D" --> <string-array name="config_companionDeviceCerts" translatable="false"> <item>YOUR_COMPANION_APP_CERTIFICATE</item> </string-array>
Use
AssociationRequest
to make an association request to a single companion device.
Validation
To test the behavior of the companion device profile feature, use the CTS
tests in
cts/tests/tests/companion/
.