Integrating your app with the People Provider ecosystem requires careful planning of your data synchronization strategy, permissions, and image hosting. Making these architectural decisions early helps your app align with Android performance and battery guidelines while securely exposing user reachability.
This guide focuses on architectural decisions for People Directory providers (communication apps). If you're building a client app, such as a dialer or contacts manager, see Query aggregated People Directories.
Register only one People Directory per package
An app package can register at most one People Directory. If a package declares
multiple ContentProvider components with <property
android:name="android.content.PeopleDirectory" android:value="true" />, the
Android system ignores all directory declarations from that package.
- Multiplex multiple accounts: If your app supports multiple accounts or
sub-services, multiplex those accounts within a single
ContentProviderimplementation under one authority.
Choose the appropriate synchronization strategy
The People Provider maintains an internal database to deliver fast query responses across directories. Keep this internal database synchronized using the most efficient API for the task:
- Update incrementally for real-time changes (
Directory.notifyChange): CallPeopleContract.Directory.notifyChangewhenever a user updates a profile, modifies reachability capabilities, adds a contact, or deletes a conversation. Pass the exact query arguments matching the modified record so the system performs a lightweight targeted synchronization into its internal database. - Refresh fully only for large-scale state transitions
(
Directory.requestRefresh): CallPeopleContract.Directory.requestRefreshonly after major lifecycle events, such as initial account setup, cloud database restores, or user sign-outs. Because full refreshes trigger background batch jobs that re-query your directory, avoid callingrequestRefreshfor routine single-record edits.
Host contact photos using standard web URLs
The People Provider aggregates contact photos from multiple People Directories for display in system surfaces:
- Use public web URLs (HTTPS): The
photo_uricolumn should contain a standard web URL, such ashttps://cdn.example.com/avatars/user123.jpg. - Avoid
content://URIs: Don't serve photo avatars usingcontent://URIs. Servingcontent://URIs requires cross-process memory usage and permission grants that degrade performance across client apps.
Define reachability using capability bitmasks
Populate the capability bitmask column using flags from
PeopleContract.Capability to accurately reflect a contact's live account
status:
Capability.VOICE_REACHABILITY: The contact can receive incoming VoIP voice calls.Capability.VIDEO_REACHABILITY: The contact can receive incoming VoIP video calls.Capability.TEXT_REACHABILITY: The contact can receive direct text messages.
Combine flags using bitwise OR (VOICE_REACHABILITY | VIDEO_REACHABILITY |
TEXT_REACHABILITY) based on the contact's live account status.
Restrict direct access to your directory
The Android system checks that only apps with the
android.permission.MANAGE_CONTACTS permission can access data aggregated from
your People Directory.
To restrict access so that only the Android system People Provider can query
your People Directory ContentProvider or launch your interaction Activity,
protect your <provider> with
android:readPermission="android.permission.BIND_DIRECTORY_SEARCH" and your
interaction <activity> with
android:permission="android.permission.BIND_DIRECTORY_SEARCH" in your
manifest. This permission is granted only to system services, protecting your
user records from unauthorized access by other installed apps.
What's next
- Implement a directory: Follow Expose contacts as a People Directory
to write your manifest tags and
ContentProvider. - Query directories: Follow Query aggregated People Directories to read contacts and launch communication flows.