See Also: ContentResolver Members
This class provides applications access to the content model.
For more information about using a ContentResolver with content providers, read the Content Providers developer guide.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Java.Lang.String | ContentResolver.AnyCursorItemType | This is the Android platform's generic MIME type to match any MIME type of the form "ContentResolver.CursorItemBaseType/SUB_TYPE". | |||||||||
Java.Lang.String | ContentResolver.CursorDirBaseType | This is the Android platform's base MIME type for a content: URI containing a Cursor of zero or more items. | |||||||||
Java.Lang.String | ContentResolver.CursorItemBaseType | This is the Android platform's base MIME type for a content: URI containing a Cursor of a single item. | |||||||||
Java.Lang.String | ContentResolver.ExtraSize | An extra Android.Graphics.Point describing the optimal size for a requested image resource, in pixels. | |||||||||
Java.Lang.String | ContentResolver.SchemeAndroidResource | ||||||||||
Java.Lang.String | ContentResolver.SchemeContent | ||||||||||
Java.Lang.String | ContentResolver.SchemeFile | ||||||||||
Java.Lang.String | ContentResolver.SyncExtrasAccount | This constant was deprecated in API level 5. instead use ContentResolver.RequestSync(Android.Accounts.Account, System.String, System.String) | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasDiscardLocalDeletions | Indicates that the sync adapter should not proceed with the delete operations, if it determines that there are too many. | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasDoNotRetry | If this extra is set to true then the request will not be retried if it fails. | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasExpedited | If this extra is set to true, the sync request will be scheduled at the front of the sync request queue and without any delay | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasForce | This constant was deprecated in API level 5. instead use ContentResolver.SyncExtrasManual | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasIgnoreBackoff | If this extra is set to true then any backoffs for the initial attempt (e.g. | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasIgnoreSettings | If this extra is set to true then the sync settings (like getSyncAutomatically()) are ignored by the sync scheduler. | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasInitialize | Set by the SyncManager to request that the SyncAdapter initialize itself for the given account/authority pair. | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasManual | Setting this extra is the equivalent of setting both ContentResolver.SyncExtrasIgnoreSettings and ContentResolver.SyncExtrasIgnoreBackoff | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasOverrideTooManyDeletions | Indicates that the sync adapter should proceed with the delete operations, even if it determines that there are too many. | |||||||||
Java.Lang.String | ContentResolver.SyncExtrasUpload | Indicates that this sync is intended to only upload local changes to the server. | |||||||||
int | ContentResolver.SyncObserverTypeActive | ||||||||||
int | ContentResolver.SyncObserverTypePending | ||||||||||
int | ContentResolver.SyncObserverTypeSettings |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
Java.Lang.Object |
This is the Android platform's generic MIME type to match any MIME type of the form "ContentResolver.CursorItemBaseType/SUB_TYPE". SUB_TYPE is the sub-type of the application-dependent content, e.g., "audio", "video", "playlist".
Constant Value: "vnd.android.cursor.item/*"This is the Android platform's base MIME type for a content: URI containing a Cursor of zero or more items. Applications should use this as the base type along with their own sub-type of their content: URIs that represent a directory of items. For example, hypothetical IMAP email client may have a URI content://com.company.provider.imap/inbox for all of the messages in its inbox, whose MIME type would be reported as CURSOR_DIR_BASE_TYPE + "/vnd.company.imap-msg"
Note how the base MIME type varies between this and ContentResolver.CursorItemBaseType depending on whether there is one single item or multiple items in the data set, while the sub-type remains the same because in either case the data structure contained in the cursor is the same.
Constant Value: "vnd.android.cursor.dir"This is the Android platform's base MIME type for a content: URI containing a Cursor of a single item. Applications should use this as the base type along with their own sub-type of their content: URIs that represent a particular item. For example, hypothetical IMAP email client may have a URI content://com.company.provider.imap/inbox/1 for a particular message in the inbox, whose MIME type would be reported as CURSOR_ITEM_BASE_TYPE + "/vnd.company.imap-msg"
Compare with ContentResolver.CursorDirBaseType.
Constant Value: "vnd.android.cursor.item"An extra Android.Graphics.Point describing the optimal size for a requested image resource, in pixels. If a provider has multiple sizes of the image, it should return the image closest to this size.
Constant Value: "android.resource"
Constant Value: "content"
Constant Value: "file"
This constant was deprecated
in API level 5.
instead use
ContentResolver.RequestSync(Android.Accounts.Account, System.String, System.String)
Constant Value: "account"
Indicates that the sync adapter should not proceed with the delete operations, if it determines that there are too many. See SyncResult.TooManyDeletions
Constant Value: "discard_deletions"If this extra is set to true then the request will not be retried if it fails. Constant Value: "do_not_retry"
If this extra is set to true, the sync request will be scheduled at the front of the sync request queue and without any delay Constant Value: "expedited"
This constant was deprecated
in API level 5.
instead use
ContentResolver.SyncExtrasManual
Constant Value: "force"
If this extra is set to true then any backoffs for the initial attempt (e.g. due to retries) are ignored by the sync scheduler. If this request fails and gets rescheduled then the retries will still honor the backoff. Constant Value: "ignore_backoff"
If this extra is set to true then the sync settings (like getSyncAutomatically()) are ignored by the sync scheduler. Constant Value: "ignore_settings"
Set by the SyncManager to request that the SyncAdapter initialize itself for the given account/authority pair. One required initialization step is to ensure that ContentResolver.SetIsSyncable(Android.Accounts.Account, System.String, System.String) has been called with a >= 0 value. When this flag is set the SyncAdapter does not need to do a full sync, though it is allowed to do so.
Constant Value: "initialize"Setting this extra is the equivalent of setting both ContentResolver.SyncExtrasIgnoreSettings and ContentResolver.SyncExtrasIgnoreBackoff
Constant Value: "force"Indicates that the sync adapter should proceed with the delete operations, even if it determines that there are too many. See SyncResult.TooManyDeletions
Constant Value: "deletions_override"Indicates that this sync is intended to only upload local changes to the server. For example, this will be set to true if the sync is initiated by a call to ContentResolver.NotifyChange(Android.Net.Uri, Android.Database.ContentObserver, Android.Database.ContentObserver)
Constant Value: "upload"Constant Value: 4 (0x00000004)
Constant Value: 2 (0x00000002)
Constant Value: 1 (0x00000001)
Returns a Android.Content.ContentProviderClient that is associated with the Android.Content.ContentProvider that services the content at uri, starting the provider if necessary. Returns null if there is no provider associated wih the uri. The caller must indicate that they are done with the provider by calling ContentProviderClient.Release which will allow the system to release the provider it it determines that there is no other reason for keeping it active.
uri | specifies which provider should be acquired |
---|
Returns a Android.Content.ContentProviderClient that is associated with the Android.Content.ContentProvider with the authority of name, starting the provider if necessary. Returns null if there is no provider associated wih the uri. The caller must indicate that they are done with the provider by calling ContentProviderClient.Release which will allow the system to release the provider it it determines that there is no other reason for keeping it active.
name | specifies which provider should be acquired |
---|
Like ContentResolver.AcquireContentProviderClient(Android.Net.Uri), but for use when you do not trust the stability of the target content provider. This turns off the mechanism in the platform clean up processes that are dependent on a content provider if that content provider's process goes away. Normally you can safely assume that once you have acquired a provider, you can freely use it as needed and it won't disappear, even if your process is in the background. If using this method, you need to take care to deal with any failures when communicating with the provider, and be sure to close it so that it can be re-opened later. In particular, catching a Android.OS.DeadObjectException from the calls there will let you know that the content provider has gone away; at that point the current ContentProviderClient object is invalid, and you should release it. You can acquire a new one if you would like to try to restart the provider and perform new operations on it.
Like ContentResolver.AcquireContentProviderClient(string), but for use when you do not trust the stability of the target content provider. This turns off the mechanism in the platform clean up processes that are dependent on a content provider if that content provider's process goes away. Normally you can safely assume that once you have acquired a provider, you can freely use it as needed and it won't disappear, even if your process is in the background. If using this method, you need to take care to deal with any failures when communicating with the provider, and be sure to close it so that it can be re-opened later. In particular, catching a Android.OS.DeadObjectException from the calls there will let you know that the content provider has gone away; at that point the current ContentProviderClient object is invalid, and you should release it. You can acquire a new one if you would like to try to restart the provider and perform new operations on it.
Specifies that a sync should be requested with the specified the account, authority, and extras at the given frequency. If there is already another periodic sync scheduled with the account, authority and extras then a new periodic sync won't be added, instead the frequency of the previous one will be updated.
These periodic syncs honor the "syncAutomatically" and "masterSyncAutomatically" settings. Although these sync are scheduled at the specified frequency, it may take longer for it to actually be started if other syncs are ahead of it in the sync operation queue. This means that the actual start time may drift.
Periodic syncs are not allowed to have any of ContentResolver.SyncExtrasDoNotRetry, ContentResolver.SyncExtrasIgnoreBackoff, ContentResolver.SyncExtrasIgnoreSettings, ContentResolver.SyncExtrasInitialize, ContentResolver.SyncExtrasForce, ContentResolver.SyncExtrasExpedited, ContentResolver.SyncExtrasManual set to true. If any are supplied then an Java.Lang.IllegalArgumentException will be thrown.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#WRITE_SYNC_SETTINGS.
The bundle for a periodic sync can be queried by applications with the correct permissions using ContentResolver.GetPeriodicSyncs(Android.Accounts.Account, System.String), so no sensitive data should be transferred here.
account | the account to specify in the sync |
---|---|
authority | the provider to specify in the sync request |
extras | extra parameters to go along with the sync request |
pollFrequency | how frequently the sync should be performed, in seconds. |
Java.Lang.IllegalArgumentException | if an illegal extra was set or if any of the parameters are null. |
---|
Request notifications when the different aspects of the SyncManager change. The different items that can be requested are:
mask | the status change types that will cause the callback to be invoked |
---|---|
callback | observer to be invoked when the status changes |
Applies each of the Android.Content.ContentProviderOperation objects and returns an array of their results. Passes through OperationApplicationException, which may be thrown by the call to ContentProviderOperation.Apply(ContentProvider, Android.Content.ContentProviderResult[], Android.Content.ContentProviderResult[]). If all the applications succeed then a Android.Content.ContentProviderResult array with the same number of elements as the operations will be returned. It is implementation-specific how many, if any, operations will have been successfully applied if a call to apply results in a Android.Content.OperationApplicationException.
authority | the authority of the ContentProvider to which this batch should be applied |
---|---|
operations | the operations to apply |
Android.Content.OperationApplicationException | thrown if an application fails. See ContentProviderOperation.Apply(ContentProvider, Android.Content.ContentProviderResult[], Android.Content.ContentProviderResult[]) for more information. |
---|---|
Android.OS.RemoteException | thrown if a RemoteException is encountered while attempting to communicate with a remote provider. |
Inserts multiple rows into a table at the given URL. This function make no guarantees about the atomicity of the insertions.
url | The URL of the table to insert into. |
---|---|
values | The initial values for the newly inserted rows. The key is the column name for the field. Passing null will create an empty row. |
Call a provider-defined method. This can be used to implement read or write interfaces which are cheaper than using a Cursor and/or do not fit into the traditional table model.
method | provider-defined method name to call. Opaque to framework, but must be non-null. |
---|---|
arg | provider-defined String argument. May be null. |
extras | provider-defined Bundle argument. May be null. |
Java.Lang.NullPointerException | if uri or method is null |
---|---|
Java.Lang.IllegalArgumentException | if uri is not known |
Remove the specified sync. This will cancel any pending or active syncs. If the request is for a periodic sync, this call will remove any future occurrences. It is possible to cancel a sync using a SyncRequest object that is not the same object with which you requested the sync. Do so by building a SyncRequest with the same adapter, frequency, and extras bundle.
If a periodic sync is specified, the caller must hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#WRITE_SYNC_SETTINGS.
request | SyncRequest object containing information about sync to cancel. |
---|
Cancel any active or pending syncs that match account and authority. The account and authority can each independently be set to null, which means that syncs with any account or authority, respectively, will match.
account | filters the syncs that match by this account |
---|---|
authority | filters the syncs that match by this authority |
This method was deprecated
in API level 5.
instead use ContentResolver.CancelSync(Android.Accounts.Account, System.String)
Cancel any active or pending syncs that match the Uri. If the uri is null then all syncs will be canceled.
uri | the uri of the provider to sync or null to sync all providers. |
---|
Transform the given url to a canonical representation of its referenced resource, which can be used across devices, persisted, backed up and restored, etc. The returned Uri is still a fully capable Uri for use with its content provider, allowing you to do all of the same content provider operations as with the original Uri -- ContentResolver.Query(Android.Net.Uri, System.String[], System.String[], System.String[], System.String[]), ContentResolver.OpenInputStream(Android.Net.Uri), etc. The only difference in behavior between the original and new Uris is that the content provider may need to do some additional work at each call using it to resolve it to the correct resource, especially if the canonical Uri has been moved to a different environment.
If you are moving a canonical Uri between environments, you should perform another call to ContentResolver.Canonicalize(Android.Net.Uri) with that original Uri to re-canonicalize it for the current environment. Alternatively, you may want to use ContentResolver.Uncanonicalize(Android.Net.Uri) to transform it to a non-canonical Uri that works only in the current environment but potentially more efficiently than the canonical representation.
url | The Android.Net.Uri that is to be transformed to a canonical representation. Like all resolver calls, the input can be either a non-canonical or canonical Uri. |
---|
Deletes row(s) specified by a content URI. If the content provider supports transactions, the deletion will be atomic.
url | The URL of the row to delete. |
---|---|
where | A filter to apply to rows before deleting, formatted as an SQL WHERE clause (excluding the WHERE itself). |
This method was deprecated
in API level 11.
Since multiple concurrent syncs are now supported you should use
ContentResolver.CurrentSyncs to get the accurate list of current syncs.
This method returns the first item from the list of current syncs
or null if there are none.
If a sync is active returns the information about it, otherwise returns null.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#READ_SYNC_STATS.
Returns a list with information about all the active syncs. This list will be empty if there are no active syncs.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#READ_SYNC_STATS.
Check if this account/provider is syncable.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#READ_SYNC_SETTINGS.
Gets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#READ_SYNC_SETTINGS.
Return list of all persisted URI permission grants that are hosted by the calling app. That is, the returned permissions have been granted from the calling app. Only grants taken with ContentResolver.TakePersistableUriPermission(Android.Net.Uri, Android.Content.ActivityFlags) are returned.
Get the list of information about the periodic syncs for the given account and authority.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#READ_SYNC_SETTINGS.
account | the account whose periodic syncs we are querying |
---|---|
authority | the provider whose periodic syncs we are querying |
Return list of all URI permission grants that have been persisted by the calling app. That is, the returned permissions have been granted to the calling app. Only persistable grants taken with ContentResolver.TakePersistableUriPermission(Android.Net.Uri, Android.Content.ActivityFlags) are returned.
Query for the possible MIME types for the representations the given content URL can be returned when opened as as stream with ContentResolver.OpenTypedAssetFileDescriptor(Android.Net.Uri, System.String, System.String). Note that the types here are not necessarily a superset of the type returned by ContentResolver.GetType(Android.Net.Uri) -- many content providers cannot return a raw stream for the structured data that they contain.
url | A Uri identifying content (either a list or specific type), using the content:// scheme. |
---|---|
mimeTypeFilter | The desired MIME type. This may be a pattern, such as */*, to query for all available MIME types that match the pattern. |
Get information about the SyncAdapters that are known to the system.
Check if the provider should be synced when a network tickle is received
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#READ_SYNC_SETTINGS.
account | the account whose setting we are querying |
---|---|
authority | the provider whose setting we are querying |
Return the MIME type of the given content URL.
url | A Uri identifying content (either a list or specific type), using the content:// scheme. |
---|
Inserts a row into a table at the given URL. If the content provider supports transactions the insertion will be atomic.
url | The URL of the table to insert into. |
---|---|
values | The initial values for the newly inserted row. The key is the column name for the field. Passing an empty ContentValues will create an empty row. |
Returns true if there is currently a sync operation for the given account or authority actively being processed.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#READ_SYNC_STATS.
account | the account whose setting we are querying |
---|---|
authority | the provider whose behavior is being queried |
Return true if the pending status is true of any matching authorities.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#READ_SYNC_STATS.
account | the account whose setting we are querying |
---|---|
authority | the provider whose behavior is being queried |
Notify registered observers that a row was updated. To register, call ContentResolver.RegisterContentObserver(Android.Net.Uri, System.Boolean, System.Boolean). By default, CursorAdapter objects will get this notification. If syncToNetwork is true, this will attempt to schedule a local sync using the sync adapter that's registered for the authority of the provided uri. No account will be passed to the sync adapter, so all matching accounts will be synchronized.
uri | The uri of the content that was changed. |
---|---|
observer | The observer that originated the change, may be null. The observer that originated the change will only receive the notification if it has requested to receive self-change notifications by implementing Android.Database.ContentObserver.DeliverSelfNotifications to return true. |
syncToNetwork | If true, attempt to sync the change to the network. |
Notify registered observers that a row was updated and attempt to sync changes to the network. To register, call ContentResolver.RegisterContentObserver(Android.Net.Uri, System.Boolean, System.Boolean). By default, CursorAdapter objects will get this notification.
uri | The uri of the content that was changed. |
---|---|
observer | The observer that originated the change, may be null. The observer that originated the change will only receive the notification if it has requested to receive self-change notifications by implementing Android.Database.ContentObserver.DeliverSelfNotifications to return true. |
Open a raw file descriptor to access data under a URI. This interacts with the underlying ContentProvider.OpenAssetFile(Android.Net.Uri, System.String) method of the provider associated with the given URI, to retrieve any file stored there.
A Uri object can be used to reference a resource in an APK file. The Uri should be one of the following formats:
java Example
Uri uri = Uri.parse("android.resource://com.example.myapp/" + R.raw.my_resource");
java Example
Uri uri = Uri.parse("android.resource://com.example.myapp/raw/my_resource");
Note that if this function is called for read-only input (mode is "r") on a content: URI, it will instead call ContentResolver.OpenTypedAssetFileDescriptor(Android.Net.Uri, System.String, System.String) for you with a MIME type of "*/*". This allows such callers to benefit from any built-in data conversion that a provider implements.
uri | The desired URI to open. |
---|---|
mode | The file mode to use, as per ContentProvider.OpenAssetFile(Android.Net.Uri, System.String). |
Java.IO.FileNotFoundException | Throws FileNotFoundException of no file exists under the URI or the mode is invalid. |
---|
Open a raw file descriptor to access data under a URI. This interacts with the underlying ContentProvider.OpenAssetFile(Android.Net.Uri, System.String) method of the provider associated with the given URI, to retrieve any file stored there.
A Uri object can be used to reference a resource in an APK file. The Uri should be one of the following formats:
java Example
Uri uri = Uri.parse("android.resource://com.example.myapp/" + R.raw.my_resource");
java Example
Uri uri = Uri.parse("android.resource://com.example.myapp/raw/my_resource");
Note that if this function is called for read-only input (mode is "r") on a content: URI, it will instead call ContentResolver.OpenTypedAssetFileDescriptor(Android.Net.Uri, System.String, System.String) for you with a MIME type of "*/*". This allows such callers to benefit from any built-in data conversion that a provider implements.
uri | The desired URI to open. |
---|---|
mode | The file mode to use, as per ContentProvider.OpenAssetFile(Android.Net.Uri, System.String). |
cancellationSignal | A signal to cancel the operation in progress, or null if none. If the operation is canceled, then Android.OS.OperationCanceledException will be thrown. |
Java.IO.FileNotFoundException | Throws FileNotFoundException of no file exists under the URI or the mode is invalid. |
---|
Open a raw file descriptor to access data under a URI. This is like ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String), but uses the underlying ContentProvider.OpenFile(Android.Net.Uri, System.String) ContentProvider.openFile()} method, so will not work with providers that return sub-sections of files. If at all possible, you should use ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String). You will receive a FileNotFoundException exception if the provider returns a sub-section of a file.
See ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String) for more information on these schemes.
If opening with the exclusive "r" or "w" modes, the returned ParcelFileDescriptor could be a pipe or socket pair to enable streaming of data. Opening with the "rw" mode implies a file on disk that supports seeking. If possible, always use an exclusive mode to give the underlying Android.Content.ContentProvider the most flexibility.
If you are writing a file, and need to communicate an error to the provider, use Android.OS.ParcelFileDescriptor.CloseWithError(string).
uri | The desired URI to open. |
---|---|
mode | The file mode to use, as per ContentProvider.OpenFile(Android.Net.Uri, System.String). |
cancellationSignal | A signal to cancel the operation in progress, or null if none. If the operation is canceled, then Android.OS.OperationCanceledException will be thrown. |
Java.IO.FileNotFoundException | Throws FileNotFoundException if no file exists under the URI or the mode is invalid. |
---|
Open a raw file descriptor to access data under a URI. This is like ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String), but uses the underlying ContentProvider.OpenFile(Android.Net.Uri, System.String) ContentProvider.openFile()} method, so will not work with providers that return sub-sections of files. If at all possible, you should use ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String). You will receive a FileNotFoundException exception if the provider returns a sub-section of a file.
See ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String) for more information on these schemes.
If opening with the exclusive "r" or "w" modes, the returned ParcelFileDescriptor could be a pipe or socket pair to enable streaming of data. Opening with the "rw" mode implies a file on disk that supports seeking. If possible, always use an exclusive mode to give the underlying Android.Content.ContentProvider the most flexibility.
If you are writing a file, and need to communicate an error to the provider, use Android.OS.ParcelFileDescriptor.CloseWithError(string).
uri | The desired URI to open. |
---|---|
mode | The file mode to use, as per ContentProvider.OpenFile(Android.Net.Uri, System.String). |
Java.IO.FileNotFoundException | Throws FileNotFoundException if no file exists under the URI or the mode is invalid. |
---|
Open a stream on to the content associated with a content URI. If there is no data associated with the URI, FileNotFoundException is thrown.
See ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String) for more information on these schemes.
uri | The desired URI. |
---|
Java.IO.FileNotFoundException | if the provided URI could not be opened. |
---|
Synonym for ContentResolver.OpenOutputStream(Android.Net.Uri, System.String).
Java.IO.FileNotFoundException | if the provided URI could not be opened. |
---|
Open a stream on to the content associated with a content URI. If there is no data associated with the URI, FileNotFoundException is thrown.
See ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String) for more information on these schemes.
uri | The desired URI. |
---|---|
mode | May be "w", "wa", "rw", or "rwt". |
Java.IO.FileNotFoundException | if the provided URI could not be opened. |
---|
Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI. This interacts with the underlying ContentProvider.OpenTypedAssetFile(Android.Net.Uri, System.String, System.String) method of the provider associated with the given URI, to retrieve retrieve any appropriate data stream for the data stored there.
Unlike ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String), this function only works with "content:" URIs, because content providers are the only facility with an associated MIME type to ensure that the returned data stream is of the desired type.
All text/* streams are encoded in UTF-8.
uri | The desired URI to open. |
---|---|
mimeType | The desired MIME type of the returned data. This can be a pattern such as */*, which will allow the content provider to select a type, though there is no way for you to determine what type it is returning. |
opts | Additional provider-dependent options. |
cancellationSignal | A signal to cancel the operation in progress, or null if none. If the operation is canceled, then Android.OS.OperationCanceledException will be thrown. |
Java.IO.FileNotFoundException | Throws FileNotFoundException of no data of the desired type exists under the URI. |
---|
Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI. This interacts with the underlying ContentProvider.OpenTypedAssetFile(Android.Net.Uri, System.String, System.String) method of the provider associated with the given URI, to retrieve retrieve any appropriate data stream for the data stored there.
Unlike ContentResolver.OpenAssetFileDescriptor(Android.Net.Uri, System.String), this function only works with "content:" URIs, because content providers are the only facility with an associated MIME type to ensure that the returned data stream is of the desired type.
All text/* streams are encoded in UTF-8.
uri | The desired URI to open. |
---|---|
mimeType | The desired MIME type of the returned data. This can be a pattern such as */*, which will allow the content provider to select a type, though there is no way for you to determine what type it is returning. |
opts | Additional provider-dependent options. |
Java.IO.FileNotFoundException | Throws FileNotFoundException of no data of the desired type exists under the URI. |
---|
Query the given URI, returning a Android.Database.ICursor over the result set.
For best performance, the caller should follow these guidelines:
uri | The URI, using the content:// scheme, for the content to retrieve. |
---|---|
projection | A list of which columns to return. Passing null will return all columns, which is inefficient. |
selection | A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will return all rows for the given URI. |
selectionArgs | You may include ?s in selection, which will be replaced by the values from selectionArgs, in the order that they appear in the selection. The values will be bound as Strings. |
sortOrder | How to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing null will use the default sort order, which may be unordered. |
Query the given URI, returning a Android.Database.ICursor over the result set with optional support for cancellation.
For best performance, the caller should follow these guidelines:
uri | The URI, using the content:// scheme, for the content to retrieve. |
---|---|
projection | A list of which columns to return. Passing null will return all columns, which is inefficient. |
selection | A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will return all rows for the given URI. |
selectionArgs | You may include ?s in selection, which will be replaced by the values from selectionArgs, in the order that they appear in the selection. The values will be bound as Strings. |
sortOrder | How to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing null will use the default sort order, which may be unordered. |
cancellationSignal | A signal to cancel the operation in progress, or null if none. If the operation is canceled, then Android.OS.OperationCanceledException will be thrown when the query is executed. |
Register an observer class that gets callbacks when data identified by a given content URI changes.
uri | The URI to watch for changes. This can be a specific row URI, or a base URI for a whole class of content. |
---|---|
notifyForDescendents | If true changes to URIs beginning with uri will also cause notifications to be sent. If false only changes to the exact URI specified by uri will cause notifications to be sent. If true, any URI values at or below the specified URI will also trigger a match. |
observer | The object that receives callbacks when changes occur. |
Relinquish a persisted URI permission grant. The URI must have been previously made persistent with ContentResolver.TakePersistableUriPermission(Android.Net.Uri, Android.Content.ActivityFlags). Any non-persistent grants to the calling package will remain intact.
Remove a periodic sync. Has no affect if account, authority and extras don't match an existing periodic sync.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#WRITE_SYNC_SETTINGS.
account | the account of the periodic sync to remove |
---|---|
authority | the provider of the periodic sync to remove |
extras | the extras of the periodic sync to remove |
Remove a previously registered status change listener.
handle | the handle that was returned by ContentResolver.AddStatusChangeListener(SyncObserverType, Android.Content.ISyncStatusObserver) |
---|
Start an asynchronous sync operation. If you want to monitor the progress of the sync you may register a SyncObserver. Only values of the following types may be used in the extras bundle:
account | which account should be synced |
---|---|
authority | which authority should be synced |
extras | any extras to pass to the SyncAdapter. |
Register a sync with the SyncManager. These requests are built using the NoType:android/content/SyncRequest$Builder;Href=../../../reference/android/content/SyncRequest.Builder.html.
Set whether this account/provider is syncable.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#WRITE_SYNC_SETTINGS.
syncable | >0 denotes syncable, 0 means not syncable, <0 means unknown |
---|
Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#WRITE_SYNC_SETTINGS.
sync | the master auto-sync setting that applies to all the providers and accounts |
---|
Set whether or not the provider is synced when it receives a network tickle.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#WRITE_SYNC_SETTINGS.
account | the account whose setting we are querying |
---|---|
authority | the provider whose behavior is being controlled |
sync | true if the provider should be synced when tickles are received for it |
This method was deprecated
in API level 5.
instead use
ContentResolver.RequestSync(Android.Accounts.Account, System.String, System.String)
Start an asynchronous sync operation. If you want to monitor the progress of the sync you may register a SyncObserver. Only values of the following types may be used in the extras bundle:
uri | the uri of the provider to sync or null to sync all providers. |
---|---|
extras | any extras to pass to the SyncAdapter. |
Take a persistable URI permission grant that has been offered. Once taken, the permission grant will be remembered across device reboots. Only URI permissions granted with Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION can be persisted. If the grant has already been persisted, taking it again will touch UriPermission.PersistedTime.
Given a canonical Uri previously generated by ContentResolver.Canonicalize(Android.Net.Uri), convert it to its local non-canonical form. This can be useful in some cases where you know that you will only be using the Uri in the current environment and want to avoid any possible overhead when using it with the content provider or want to verify that the referenced data exists at all in the new environment.
url | The canonical Android.Net.Uri that is to be convered back to its non-canonical form. |
---|
Unregisters a change observer.
observer | The previously registered observer that is no longer needed. |
---|
Update row(s) in a content URI. If the content provider supports transactions the update will be atomic.
uri | The URI to modify. |
---|---|
values | The new field values. The key is the column name for the field. A null value will remove an existing field value. |
where | A filter to apply to rows before updating, formatted as an SQL WHERE clause (excluding the WHERE itself). |
Java.Lang.NullPointerException | if uri or values are null |
---|
Check that only values of the following types are in the Bundle:
extras | the Bundle to check |
---|