PeopleContract.Directory
public
static
final
class
PeopleContract.Directory
extends Object
| java.lang.Object | |
| ↳ | 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 | |
|---|---|
String |
CONTENT_ITEM_TYPE
The MIME type of a |
String |
CONTENT_TYPE
The MIME type of |
String |
DIRECTORY_AUTHORITY
Column name for the authority of the People Directory application. |
String |
DIRECTORY_PROPERTY
Manifest property name that a |
String |
PACKAGE_NAME
Column name for the package name of the application providing the People Directory. |
Fields | |
|---|---|
public
static
final
Uri |
CONTENT_URI
The content:// style URI for querying the list of registered People Directories. |
Public methods | |
|---|---|
static
boolean
|
notifyChange(Context context, Uri uri, Bundle queryArgs, 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. |
Inherited methods | |
|---|---|
Constants
CONTENT_ITEM_TYPE
public static final String CONTENT_ITEM_TYPE
The MIME type of a CONTENT_URI subdirectory of a single People Directory.
Constant Value: "vnd.android.cursor.item/people_directory"
CONTENT_TYPE
public static final String CONTENT_TYPE
The MIME type of CONTENT_URI providing a directory of People Directories.
Constant Value: "vnd.android.cursor.dir/people_directories"
DIRECTORY_AUTHORITY
public static final String DIRECTORY_AUTHORITY
Column name for the authority of the People Directory application.
Type: TEXT
Constant Value: "authority"
DIRECTORY_PROPERTY
public static final String DIRECTORY_PROPERTY
Manifest property name that a ContentProvider must define in a
<property> tag within its manifest declaration to register itself as a People
Directory with the system.
Constant Value: "android.content.PeopleDirectory"
PACKAGE_NAME
public static final String PACKAGE_NAME
Column name for the package name of the application providing the People Directory.
Type: TEXT
Constant Value: "package_name"
Fields
CONTENT_URI
public static final Uri CONTENT_URI
The content:// style URI for querying the list of registered People Directories.
Public methods
notifyChange
public static boolean notifyChange (Context context, Uri uri, Bundle queryArgs, CancellationSignal cancellationSignal)
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 ContentObserver registered on PeopleContract.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. |
| Returns | |
|---|---|
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
public static boolean requestRefresh (Context context, CancellationSignal cancellationSignal)
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. |
| Returns | |
|---|---|
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. |