> Documentation index: https://developer.android.com/identity/providers/people-directory/llms.txt

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](https://developer.android.com/identity/providers/people-directory/query-directories.md.txt).

## Register only one People Directory per package

An app package can register at most one People Directory. If a package declares
multiple [`ContentProvider`](https://developer.android.com/reference/android/content/ContentProvider.md.txt) 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 `ContentProvider` implementation 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`)** : Call [`PeopleContract.Directory.notifyChange`](https://developer.android.com/reference/android/provider/PeopleContract.Directory.md.txt#notifyChange(android.content.Context,%20android.net.Uri,%20android.os.Bundle,%20android.os.CancellationSignal)) whenever 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`)** : Call [`PeopleContract.Directory.requestRefresh`](https://developer.android.com/reference/android/provider/PeopleContract.Directory.md.txt#requestRefresh(android.content.Context,%20android.os.CancellationSignal)) only 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 calling `requestRefresh` for 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_uri` column should contain a standard web URL, such as `https://cdn.example.com/avatars/user123.jpg`.
- **Avoid `content://` URIs** : Don't serve photo avatars using `content://` URIs. Serving `content://` 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`](https://developer.android.com/reference/android/provider/PeopleContract.Capability.md.txt) 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](https://developer.android.com/identity/providers/people-directory/expose-contacts.md.txt) to write your manifest tags and `ContentProvider`.
- **Query directories** : Follow [Query aggregated People Directories](https://developer.android.com/identity/providers/people-directory/query-directories.md.txt) to read contacts and launch communication flows.

## Additional resources

- [About People Directory](https://developer.android.com/identity/providers/people-directory.md.txt)
- [`PeopleContract`](https://developer.android.com/reference/android/provider/PeopleContract.md.txt)
- [Contacts Provider](https://developer.android.com/identity/providers/contacts-provider.md.txt)
- [Permissions on Android](https://developer.android.com/guide/topics/permissions/overview.md.txt)