Språk

PeopleContract.Directory.NotifyChange Method

Definition

Notifies the People Provider that specific records within a directory have changed, triggering a cache refresh and notifying observing client applications.

[Android.Runtime.Register("notifyChange", "(Landroid/content/Context;Landroid/net/Uri;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Z", "", ApiSince=37)]
public static bool NotifyChange(Android.Content.Context context, Android.Net.Uri uri, Android.OS.Bundle? queryArgs, Android.OS.CancellationSignal? cancellationSignal);
[<Android.Runtime.Register("notifyChange", "(Landroid/content/Context;Landroid/net/Uri;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Z", "", ApiSince=37)>]
static member NotifyChange : Android.Content.Context * Android.Net.Uri * Android.OS.Bundle * Android.OS.CancellationSignal -> bool

Parameters

context
Context

The Context used to access the ContentResolver.

uri
Uri

The URI corresponding to the modified data (for example, Persons#CONTENT_URI or Groups#CONTENT_URI).

queryArgs
Bundle

A query arguments Bundle constructed using Persons.Query.Builder or Groups.Query.Builder containing selection criteria that match the modified data records.

cancellationSignal
CancellationSignal

An optional CancellationSignal to cancel the refresh operation, or null.

Returns

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 empty.

Attributes

Remarks

Notifies the People Provider that specific records within a directory have changed, enqueuing a debounced targeted maintenance job to update the local database and notify 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 local database 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 local database entries and notifies any ContentObserver registered on PeopleContract.CONTENT_NOTIFICATION_URI or query-specific notification URIs.

Android reference for android.provider.PeopleContract.Directory.notifyChange.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to