ContentResolver Class

Definition

This class provides applications access to the content model.

[Android.Runtime.Register("android/content/ContentResolver", DoNotGenerateAcw=true)]
public abstract class ContentResolver : Java.Lang.Object
[<Android.Runtime.Register("android/content/ContentResolver", DoNotGenerateAcw=true)>]
type ContentResolver = class
    inherit Object
Inheritance
ContentResolver
Derived
Attributes

Remarks

This class provides applications access to the content model.

<div class="special reference"> <h3>Developer Guides</h3>

For more information about using a ContentResolver with content providers, read the Content Providers developer guide.

</div>

Java documentation for android.content.ContentResolver.

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.

Constructors

ContentResolver(Context)

Note: passing a null context here could lead to unexpected behavior in certain ContentResolver APIs so it is highly recommended to pass a non-null context here.

ContentResolver(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

AnyCursorItemType

This is the Android platform's generic MIME type to match any MIME type of the form "#CURSOR_ITEM_BASE_TYPE/SUB_TYPE".

CursorDirBaseType

This is the Android platform's base MIME type for a content: URI containing a Cursor of zero or more items.

CursorItemBaseType

This is the Android platform's base MIME type for a content: URI containing a Cursor of a single item.

ExtraHonoredArgs

Allows provider to report back to client which query keys are honored in a Cursor.

ExtraRefreshSupported

An extra boolean describing whether a particular provider supports refresh or not.

ExtraSize

An extra Point describing the optimal size for a requested image resource, in pixels.

ExtraTotalCount

Added to Cursor extras Bundle to indicate total row count of recordset when paging is supported.

NotifyDelete
Obsolete.

Flag for #notifyChange(Uri, ContentObserver, int): typically set by a ContentProvider to indicate that this notification is the result of a ContentProvider#delete call.

NotifyInsert
Obsolete.

Flag for #notifyChange(Uri, ContentObserver, int): typically set by a ContentProvider to indicate that this notification is the result of an ContentProvider#insert call.

NotifySkipNotifyForDescendants
Obsolete.

Flag for #notifyChange(Uri, ContentObserver, int): if set, this notification will be skipped if it is being delivered to the root URI of a ContentObserver that is using "notify for descendants.

NotifySyncToNetwork
Obsolete.

Flag for #notifyChange(Uri, ContentObserver, int): attempt to sync the change to the network.

NotifyUpdate
Obsolete.

Flag for #notifyChange(Uri, ContentObserver, int): typically set by a ContentProvider to indicate that this notification is the result of an ContentProvider#update call.

QueryArgGroupColumns

Specifies the list of columns (stored as a String[]) against which to group results.

QueryArgLimit

Specifies the max number of rows to include in a Cursor.

QueryArgOffset

Specifies the offset row index within a Cursor.

QueryArgSortCollation

Allows client to specify a hint to the provider declaring which collation to use when sorting values.

QueryArgSortColumns

Specifies the list of columns (stored as a String[]) against which to sort results.

QueryArgSortDirection

Specifies desired sort order.

QueryArgSortLocale

Allows client to specify a hint to the provider declaring which locale to use when sorting values.

QueryArgSqlGroupBy

Key for an SQL style GROUP BY string that may be present in the query Bundle argument passed to ContentProvider#query(Uri, String[], Bundle, CancellationSignal).

QueryArgSqlHaving

Key for an SQL style HAVING string that may be present in the query Bundle argument passed to ContentProvider#query(Uri, String[], Bundle, CancellationSignal).

QueryArgSqlLimit

Key for an SQL style LIMIT string that may be present in the query Bundle argument passed to ContentProvider#query(Uri, String[], Bundle, CancellationSignal).

QueryArgSqlSelection

Key for an SQL style selection string that may be present in the query Bundle argument passed to ContentProvider#query(Uri, String[], Bundle, CancellationSignal) when called by a legacy client.

QueryArgSqlSelectionArgs

Key for SQL selection string arguments list.

QueryArgSqlSortOrder

Key for an SQL style sort string that may be present in the query Bundle argument passed to ContentProvider#query(Uri, String[], Bundle, CancellationSignal) when called by a legacy client.

QuerySortDirectionAscending
QuerySortDirectionDescending
SchemeAndroidResource
SchemeContent
SchemeFile
SyncExtrasAccount
Obsolete.

This member is deprecated.

SyncExtrasDiscardLocalDeletions

Indicates that the sync adapter should not proceed with the delete operations, if it determines that there are too many.

SyncExtrasDoNotRetry

If this extra is set to true then the request will not be retried if it fails.

SyncExtrasExpedited

If this extra is set to true, the sync request will be scheduled at the front of the sync request queue, but it is still subject to JobScheduler quota and throttling due to App Standby buckets.

SyncExtrasForce
Obsolete.

This member is deprecated.

SyncExtrasIgnoreBackoff

If this extra is set to true then any backoffs for the initial attempt (e.

SyncExtrasIgnoreSettings

If this extra is set to true then the sync settings (like getSyncAutomatically()) are ignored by the sync scheduler.

SyncExtrasInitialize

Set by the SyncManager to request that the SyncAdapter initialize itself for the given account/authority pair.

SyncExtrasManual

Setting this extra is the equivalent of setting both #SYNC_EXTRAS_IGNORE_SETTINGS and #SYNC_EXTRAS_IGNORE_BACKOFF

SyncExtrasOverrideTooManyDeletions

Indicates that the sync adapter should proceed with the delete operations, even if it determines that there are too many.

SyncExtrasRequireCharging

If this extra is set to true, the sync request will be scheduled only when the device is plugged in.

SyncExtrasScheduleAsExpeditedJob

Run this sync operation as an "expedited job" (see android.app.job.JobInfo.Builder#setExpedited(boolean)).

SyncExtrasUpload

Indicates that this sync is intended to only upload local changes to the server.

SyncObserverTypeActive
SyncObserverTypePending
SyncObserverTypeSettings

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
CurrentSync
Obsolete.

If a sync is active returns the information about it, otherwise returns null.

CurrentSyncs

Returns a list with information about all the active syncs.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MasterSyncAutomatically

Gets the global auto-sync setting that applies to all the providers and accounts. -or- Sets the global auto-sync setting that applies to all the providers and accounts.

OutgoingPersistedUriPermissions

Return list of all persisted URI permission grants that are hosted by the calling app.

PeerReference (Inherited from Object)
PersistedUriPermissions

Return list of all URI permission grants that have been persisted by the calling app.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AcquireContentProviderClient(String)

Returns a ContentProviderClient that is associated with the ContentProvider with the authority of name, starting the provider if necessary.

AcquireContentProviderClient(Uri)

Returns a ContentProviderClient that is associated with the ContentProvider that services the content at uri, starting the provider if necessary.

AcquireUnstableContentProviderClient(String)

Like #acquireContentProviderClient(String), but for use when you do not trust the stability of the target content provider.

AcquireUnstableContentProviderClient(Uri)

Like #acquireContentProviderClient(Uri), but for use when you do not trust the stability of the target content provider.

AddPeriodicSync(Account, String, Bundle, Int64)

Specifies that a sync should be requested with the specified the account, authority, and extras at the given frequency.

AddStatusChangeListener(SyncObserverType, ISyncStatusObserver)

Request notifications when the different aspects of the SyncManager change.

ApplyBatch(String, IList<ContentProviderOperation>)

Applies each of the ContentProviderOperation objects and returns an array of their results.

BulkInsert(Uri, ContentValues[])

Inserts multiple rows into a table at the given URL.

Call(String, String, String, Bundle)

Call a provider-defined method.

Call(Uri, String, String, Bundle)

Call a provider-defined method.

CancelSync(Account, String)

Cancel any active or pending syncs that match account and authority.

CancelSync(SyncRequest)

Remove the specified sync.

CancelSync(Uri)
Obsolete.

Cancel any active or pending syncs that match the Uri.

Canonicalize(Uri)

Transform the given <var>url</var> to a canonical representation of its referenced resource, which can be used across devices, persisted, backed up and restored, etc.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Delete(Uri, Bundle)

Deletes row(s) specified by a content URI.

Delete(Uri, String, String[])

Deletes row(s) specified by a content URI.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetIsSyncable(Account, String)

Check if this account/provider is syncable.

GetPeriodicSyncs(Account, String)

Get the list of information about the periodic syncs for the given account and authority.

GetStreamTypes(Uri, String)

Query for the possible MIME types for the representations the given content URL can be returned when opened as as stream with #openTypedAssetFileDescriptor.

GetSyncAdapterTypes()

Get information about the SyncAdapters that are known to the system.

GetSyncAutomatically(Account, String)

Check if the provider should be synced when a network tickle is received

GetType(Uri)

Return the MIME type of the given content URL.

GetTypeInfo(String)

Return a detailed description of the given MIME type, including an icon and label that describe the type.

Insert(Uri, ContentValues)

Inserts a row into a table at the given URL.

Insert(Uri, ContentValues, Bundle)

Inserts a row into a table at the given URL.

IsSyncActive(Account, String)

Returns true if there is currently a sync operation for the given account or authority actively being processed.

IsSyncPending(Account, String)

Return true if the pending status is true of any matching authorities.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
LoadThumbnail(Uri, Size, CancellationSignal)

Convenience method that efficiently loads a visual thumbnail for the given Uri.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
NotifyChange(ICollection<Uri>, ContentObserver, NotifyChangeFlags)

Notify registered observers that several rows have been updated.

NotifyChange(Uri, ContentObserver)

Notify registered observers that a row was updated and attempt to sync changes to the network.

NotifyChange(Uri, ContentObserver, Boolean)

Notify registered observers that a row was updated.

NotifyChange(Uri, ContentObserver, NotifyChangeFlags)

Notify registered observers that a row was updated.

OpenAssetFile(Uri, String, CancellationSignal)
OpenAssetFileDescriptor(Uri, String)

Open a raw file descriptor to access data under a URI.

OpenAssetFileDescriptor(Uri, String, CancellationSignal)

Open a raw file descriptor to access data under a URI.

OpenFile(Uri, String, CancellationSignal)
OpenFileDescriptor(Uri, String)

Open a raw file descriptor to access data under a URI.

OpenFileDescriptor(Uri, String, CancellationSignal)

Open a raw file descriptor to access data under a URI.

OpenInputStream(Uri)

Open a stream on to the content associated with a content URI.

OpenOutputStream(Uri)

Synonym for #openOutputStream(Uri, String) openOutputStream(uri, "w").

OpenOutputStream(Uri, String)

Open a stream on to the content associated with a content URI.

OpenTypedAssetFile(Uri, String, Bundle, CancellationSignal)
OpenTypedAssetFileDescriptor(Uri, String, Bundle)

Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI.

OpenTypedAssetFileDescriptor(Uri, String, Bundle, CancellationSignal)

Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI.

Query(Uri, String[], Bundle, CancellationSignal)

Query the given URI, returning a Cursor over the result set with support for cancellation.

Query(Uri, String[], String, String[], String)

Query the given URI, returning a Cursor over the result set.

Query(Uri, String[], String, String[], String, CancellationSignal)

Query the given URI, returning a Cursor over the result set with optional support for cancellation.

Refresh(Uri, Bundle, CancellationSignal)

This allows clients to request an explicit refresh of content identified by uri.

RegisterContentObserver(Uri, Boolean, ContentObserver)

Register an observer class that gets callbacks when data identified by a given content URI changes.

ReleasePersistableUriPermission(Uri, ActivityFlags)

Relinquish a persisted URI permission grant.

RemovePeriodicSync(Account, String, Bundle)

Remove a periodic sync.

RemoveStatusChangeListener(Object)

Remove a previously registered status change listener.

RequestSync(Account, String, Bundle)

Start an asynchronous sync operation.

RequestSync(SyncRequest)

Register a sync with the SyncManager.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetIsSyncable(Account, String, Int32)

Set whether this account/provider is syncable.

SetSyncAutomatically(Account, String, Boolean)

Set whether or not the provider is synced when it receives a network tickle.

StartSync(Uri, Bundle)
Obsolete.

Start an asynchronous sync operation.

TakePersistableUriPermission(Uri, ActivityFlags)

Take a persistable URI permission grant that has been offered.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
Uncanonicalize(Uri)

Given a canonical Uri previously generated by #canonicalize, convert it to its local non-canonical form.

UnregisterContentObserver(ContentObserver)

Unregisters a change observer.

UnregisterFromRuntime() (Inherited from Object)
Update(Uri, ContentValues, Bundle)

Update row(s) in a content URI.

Update(Uri, ContentValues, String, String[])

Update row(s) in a content URI.

ValidateSyncExtrasBundle(Bundle)

Check that only values of the following types are in the Bundle: <ul> <li>Integer</li> <li>Long</li> <li>Boolean</li> <li>Float</li> <li>Double</li> <li>String</li> <li>Account</li> <li>null</li> </ul>

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wrap(ContentProvider)

Create a ContentResolver instance that redirects all its methods to the given ContentProvider.

Wrap(ContentProviderClient)

Create a ContentResolver instance that redirects all its methods to the given ContentProviderClient.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to