Directory
class Directory
| kotlin.Any | |
| ↳ | android.provider.PeopleContract.Directory |
Constants and utilities for registering and discovering People Directories.
A People Directory is an application (such as a VoIP calling or chat messaging service) that provides person and group identity definitions to the system.
For People Directory applications: To implement a People Directory, see "Implementing a People Directory" in PeopleContract.
For client applications: Clients can query CONTENT_URI to discover all registered and active directory applications currently installed on the device.
Summary
| Constants | |
|---|---|
| static String |
The MIME type of a |
| static String |
The MIME type of |
| static String |
Column name for the authority of the People Directory application. |
| static String |
Manifest property name that a |
| static String |
Column name for the package name of the application providing the People Directory. |
| Public methods | |
|---|---|
| static Boolean |
notifyChange(context: Context, uri: Uri, queryArgs: Bundle?, cancellationSignal: CancellationSignal?)Notifies the People Provider that specific records within a directory have changed, triggering a cache refresh and notifying observing client applications. |
| static Boolean |
requestRefresh(context: Context, cancellationSignal: CancellationSignal?)Requests the system to refresh cached records across all registered People Directories. |
| Properties | |
|---|---|
| static Uri |
The content:// style URI for querying the list of registered People Directories. |
Constants
CONTENT_ITEM_TYPE
static val CONTENT_ITEM_TYPE: String
The MIME type of a CONTENT_URI subdirectory of a single People Directory.
Value: "vnd.android.cursor.item/people_directory"CONTENT_TYPE
static val CONTENT_TYPE: String
The MIME type of CONTENT_URI providing a directory of People Directories.
Value: "vnd.android.cursor.dir/people_directories"DIRECTORY_AUTHORITY
static val DIRECTORY_AUTHORITY: String
Column name for the authority of the People Directory application.
Type: TEXT
Value: "authority"DIRECTORY_PROPERTY
static val DIRECTORY_PROPERTY: String
Manifest property name that a android.content.ContentProvider must define in a <property> tag within its manifest declaration to register itself as a People Directory with the system.
Value: "android.content.PeopleDirectory"PACKAGE_NAME
static val PACKAGE_NAME: String
Column name for the package name of the application providing the People Directory.
Type: TEXT
Value: "package_name"Public methods
notifyChange
static fun notifyChange(
context: Context,
uri: Uri,
queryArgs: Bundle?,
cancellationSignal: CancellationSignal?
): Boolean
Notifies the People Provider that specific records within a directory have changed, triggering a cache refresh and notifying observing client applications.
For People Directory applications: People Directory applications should invoke this method whenever a person or group record is added, updated, or removed. This method must be invoked by the application package that owns the directory provider. Specifying the exact URI and matching query arguments allows the system to efficiently update its cache and backfill data for interested clients.
For client applications: Clients do not invoke this method. When a People Directory application calls this method, the system refreshes cache entries and notifies any android.database.ContentObserver registered on CONTENT_NOTIFICATION_URI or query-specific notification URIs.
| Parameters | |
|---|---|
context |
Context: The Context used to access the ContentResolver. This value cannot be null. |
uri |
Uri: The URI corresponding to the modified data (for example, Persons.CONTENT_URI or Groups.CONTENT_URI). This value cannot be null. |
queryArgs |
Bundle?: A query arguments Bundle constructed using Persons.Query.Builder or Groups.Query.Builder containing selection criteria that match the modified data records. This value may be null. |
cancellationSignal |
CancellationSignal?: An optional CancellationSignal to cancel the refresh operation, or null. |
| Return | |
|---|---|
Boolean |
true if the change notification was sent and refresh initiated, false if the calling package is not a registered People Directory or if the query arguments were null or empty. |
requestRefresh
static fun requestRefresh(
context: Context,
cancellationSignal: CancellationSignal?
): Boolean
Requests the system to refresh cached records across all registered People Directories.
For People Directory applications: People Directory applications can call this method after significant, large-scale state changes (such as completing an initial account synchronization or resetting database storage) to prompt the system to rebuild its directory caches. This method must be invoked by the application package that owns the directory provider.
This method is an expensive operation and should not be used as a general alternative to notifyChange(Context,Uri,Bundle,CancellationSignal) for incremental changes.
Note that this request acts as a hint to the system; the exact timing and execution of cache rebuilding depend on system conditions such as available memory and overall device state, and immediate execution is not guaranteed.
For client applications: Clients do not invoke this method.
| Parameters | |
|---|---|
context |
Context: The Context used to access the ContentResolver. This value cannot be null. |
cancellationSignal |
CancellationSignal?: An optional CancellationSignal to cancel the refresh request, or null. |
| Return | |
|---|---|
Boolean |
true if the refresh request was successfully accepted, false if the calling package is not a registered People Directory or the request could not be processed. |
Properties
CONTENT_URI
static val CONTENT_URI: Uri
The content:// style URI for querying the list of registered People Directories.