ContentProviderClient? |
acquireContentProviderClient(uri: Uri)
Returns a ContentProviderClient that is associated with the 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 if it determines that there is no other reason for keeping it active.
|
ContentProviderClient? |
acquireContentProviderClient(name: String)
Returns a ContentProviderClient that is associated with the 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 if it determines that there is no other reason for keeping it active.
|
ContentProviderClient? |
acquireUnstableContentProviderClient(uri: Uri)
Like 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.
|
ContentProviderClient? |
acquireUnstableContentProviderClient(name: String)
Like acquireContentProviderClient(java.lang.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.
|
Unit |
addPeriodicSync(account: Account!, authority: String!, extras: Bundle!, pollFrequency: Long)
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 SYNC_EXTRAS_DO_NOT_RETRY , SYNC_EXTRAS_IGNORE_BACKOFF , SYNC_EXTRAS_IGNORE_SETTINGS , SYNC_EXTRAS_INITIALIZE , SYNC_EXTRAS_FORCE , SYNC_EXTRAS_EXPEDITED , SYNC_EXTRAS_MANUAL , SYNC_EXTRAS_SCHEDULE_AS_EXPEDITED_JOB set to true. If any are supplied then an IllegalArgumentException will be thrown.
This method requires the caller to hold the permission android.Manifest.permission#WRITE_SYNC_SETTINGS .
The bundle for a periodic sync can be queried by applications with the correct permissions using ContentResolver#getPeriodicSyncs(Account account, String provider) , so no sensitive data should be transferred here.
|
Any! |
addStatusChangeListener(mask: Int, callback: SyncStatusObserver!)
Request notifications when the different aspects of the SyncManager change. The different items that can be requested are:
The caller can set one or more of the status types in the mask for any given listener registration.
|
Array<ContentProviderResult!> |
applyBatch(authority: String, operations: ArrayList<ContentProviderOperation!>)
Applies each of the ContentProviderOperation objects and returns an array of their results. Passes through OperationApplicationException, which may be thrown by the call to ContentProviderOperation#apply . If all the applications succeed then a 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 OperationApplicationException .
|
Int |
bulkInsert(url: Uri, values: Array<ContentValues!>)
Inserts multiple rows into a table at the given URL. This function make no guarantees about the atomicity of the insertions.
|
Bundle? |
call(uri: Uri, method: String, arg: String?, extras: Bundle?)
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.
|
Bundle? |
call(authority: String, method: String, arg: String?, extras: Bundle?)
|
Unit |
cancelSync(uri: Uri!)
Cancel any active or pending syncs that match the Uri. If the uri is null then all syncs will be canceled.
|
Unit |
cancelSync(account: Account!, authority: String!)
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.
|
Unit |
cancelSync(request: SyncRequest!)
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.
If a periodic sync is specified, the caller must hold the permission android.Manifest.permission#WRITE_SYNC_SETTINGS .
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.
|
Uri? |
canonicalize(url: Uri)
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 -- #query, 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 canonicalize with that original Uri to re-canonicalize it for the current environment. Alternatively, you may want to use uncanonicalize to transform it to a non-canonical Uri that works only in the current environment but potentially more efficiently than the canonical representation.
|
Int |
delete(url: Uri, where: String?, selectionArgs: Array<String!>?)
Deletes row(s) specified by a content URI. If the content provider supports transactions, the deletion will be atomic.
|
Int |
delete(url: Uri, extras: Bundle?)
Deletes row(s) specified by a content URI. If the content provider supports transactions, the deletion will be atomic.
|
SyncInfo! |
getCurrentSync()
If a sync is active returns the information about it, otherwise returns null.
This method requires the caller to hold the permission android.Manifest.permission#READ_SYNC_STATS .
|
MutableList<SyncInfo!>! |
getCurrentSyncs()
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 android.Manifest.permission#READ_SYNC_STATS .
|
Int |
getIsSyncable(account: Account!, authority: String!)
Check if this account/provider is syncable.
This method requires the caller to hold the permission android.Manifest.permission#READ_SYNC_SETTINGS .
|
Boolean |
getMasterSyncAutomatically()
Gets the global 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 android.Manifest.permission#READ_SYNC_SETTINGS .
|
MutableList<UriPermission!> |
getOutgoingPersistedUriPermissions()
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 takePersistableUriPermission(android.net.Uri,int) are returned.
Note: Some of the returned URIs may not be usable until after the user is unlocked.
|
MutableList<PeriodicSync!>! |
getPeriodicSyncs(account: Account!, authority: String!)
Get the list of information about the periodic syncs for the given account and authority.
This method requires the caller to hold the permission android.Manifest.permission#READ_SYNC_SETTINGS .
|
MutableList<UriPermission!> |
getPersistedUriPermissions()
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 takePersistableUriPermission(android.net.Uri,int) are returned.
Note: Some of the returned URIs may not be usable until after the user is unlocked.
|
Array<String!>? |
getStreamTypes(url: Uri, mimeTypeFilter: String)
Query for the possible MIME types for the representations the given content URL can be returned when opened as as stream with #openTypedAssetFileDescriptor. Note that the types here are not necessarily a superset of the type returned by getType -- many content providers cannot return a raw stream for the structured data that they contain.
|
Array<SyncAdapterType!>! |
getSyncAdapterTypes()
Get information about the SyncAdapters that are known to the system.
|
Boolean |
getSyncAutomatically(account: Account!, authority: String!)
Check if the provider should be synced when a network tickle is received
This method requires the caller to hold the permission android.Manifest.permission#READ_SYNC_SETTINGS .
|
String? |
getType(url: Uri)
Return the MIME type of the given content URL.
|
ContentResolver.MimeTypeInfo |
getTypeInfo(mimeType: String)
Return a detailed description of the given MIME type, including an icon and label that describe the type.
|
Uri? |
insert(url: Uri, values: ContentValues?)
Inserts a row into a table at the given URL. If the content provider supports transactions the insertion will be atomic.
|
Uri? |
insert(url: Uri, values: ContentValues?, extras: Bundle?)
Inserts a row into a table at the given URL. If the content provider supports transactions the insertion will be atomic.
|
Boolean |
isSyncActive(account: Account!, authority: String!)
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 android.Manifest.permission#READ_SYNC_STATS .
|
Boolean |
isSyncPending(account: Account!, authority: String!)
Return true if the pending status is true of any matching authorities.
This method requires the caller to hold the permission android.Manifest.permission#READ_SYNC_STATS .
|
Bitmap |
loadThumbnail(uri: Uri, size: Size, signal: CancellationSignal?)
Convenience method that efficiently loads a visual thumbnail for the given Uri . Internally calls android.content.ContentProvider#openTypedAssetFile on the remote provider, but also defensively resizes any returned content to match the requested target size.
|
AssetFileDescriptor? |
openAssetFile(uri: Uri, mode: String, signal: CancellationSignal?)
|
AssetFileDescriptor? |
openAssetFileDescriptor(uri: Uri, mode: String)
Open a raw file descriptor to access data under a URI. This interacts with the underlying android.content.ContentProvider#openAssetFile method of the provider associated with the given URI, to retrieve any file stored there.
Accepts the following URI schemes:
A Uri object can be used to reference a resource in an APK file. The Uri should be one of the following formats:
Note that if this function is called for read-only input (mode is "r") on a content: URI, it will instead call #openTypedAssetFileDescriptor for you with a MIME type of "*/*". This allows such callers to benefit from any built-in data conversion that a provider implements.
|
AssetFileDescriptor? |
openAssetFileDescriptor(uri: Uri, mode: String, cancellationSignal: CancellationSignal?)
Open a raw file descriptor to access data under a URI. This interacts with the underlying android.content.ContentProvider#openAssetFile method of the provider associated with the given URI, to retrieve any file stored there.
Accepts the following URI schemes:
A Uri object can be used to reference a resource in an APK file. The Uri should be one of the following formats:
Note that if this function is called for read-only input (mode is "r") on a content: URI, it will instead call #openTypedAssetFileDescriptor for you with a MIME type of "*/*". This allows such callers to benefit from any built-in data conversion that a provider implements.
|
ParcelFileDescriptor? |
openFile(uri: Uri, mode: String, signal: CancellationSignal?)
|
ParcelFileDescriptor? |
openFileDescriptor(uri: Uri, mode: String)
Open a raw file descriptor to access data under a URI. This is like openAssetFileDescriptor(android.net.Uri,java.lang.String) , but uses the underlying android.content.ContentProvider#openFile ContentProvider.openFile()} method, so will not work with providers that return sub-sections of files. If at all possible, you should use openAssetFileDescriptor(android.net.Uri,java.lang.String) . You will receive a FileNotFoundException exception if the provider returns a sub-section of a file.
Accepts the following URI schemes:
See openAssetFileDescriptor(android.net.Uri,java.lang.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 ContentProvider the most flexibility.
If you are writing a file, and need to communicate an error to the provider, use ParcelFileDescriptor#closeWithError(String) .
|
ParcelFileDescriptor? |
openFileDescriptor(uri: Uri, mode: String, cancellationSignal: CancellationSignal?)
Open a raw file descriptor to access data under a URI. This is like openAssetFileDescriptor(android.net.Uri,java.lang.String) , but uses the underlying android.content.ContentProvider#openFile ContentProvider.openFile()} method, so will not work with providers that return sub-sections of files. If at all possible, you should use openAssetFileDescriptor(android.net.Uri,java.lang.String) . You will receive a FileNotFoundException exception if the provider returns a sub-section of a file.
Accepts the following URI schemes:
See openAssetFileDescriptor(android.net.Uri,java.lang.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 ContentProvider the most flexibility.
If you are writing a file, and need to communicate an error to the provider, use ParcelFileDescriptor#closeWithError(String) .
|
InputStream? |
openInputStream(uri: Uri)
Open a stream on to the content associated with a content URI. If there is no data associated with the URI, FileNotFoundException is thrown.
Accepts the following URI schemes:
See openAssetFileDescriptor(android.net.Uri,java.lang.String) for more information on these schemes.
|
OutputStream? |
openOutputStream(uri: Uri)
Synonym for openOutputStream(uri, "w") . Please note the implementation of "w" is up to each Provider implementation and it may or may not truncate.
|
OutputStream? |
openOutputStream(uri: Uri, mode: String)
Open a stream on to the content associated with a content URI. If there is no data associated with the URI, FileNotFoundException is thrown.
Accepts the following URI schemes:
See openAssetFileDescriptor(android.net.Uri,java.lang.String) for more information on these schemes.
|
AssetFileDescriptor? |
openTypedAssetFile(uri: Uri, mimeTypeFilter: String, opts: Bundle?, signal: CancellationSignal?)
|
AssetFileDescriptor? |
openTypedAssetFileDescriptor(uri: Uri, mimeType: String, opts: Bundle?)
Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI. This interacts with the underlying android.content.ContentProvider#openTypedAssetFile method of the provider associated with the given URI, to retrieve retrieve any appropriate data stream for the data stored there.
Unlike #openAssetFileDescriptor, 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.
|
AssetFileDescriptor? |
openTypedAssetFileDescriptor(uri: Uri, mimeType: String, opts: Bundle?, cancellationSignal: CancellationSignal?)
Open a raw file descriptor to access (potentially type transformed) data from a "content:" URI. This interacts with the underlying android.content.ContentProvider#openTypedAssetFile method of the provider associated with the given URI, to retrieve any appropriate data stream for the data stored there.
Unlike #openAssetFileDescriptor, 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.
|
Cursor? |
query(uri: Uri, projection: Array<String!>?, selection: String?, selectionArgs: Array<String!>?, sortOrder: String?)
Query the given URI, returning a Cursor over the result set.
For best performance, the caller should follow these guidelines:
- Provide an explicit projection, to prevent reading data from storage that aren't going to be used.
- Use question mark parameter markers such as 'phone=?' instead of explicit values in the
selection parameter, so that queries that differ only by those values will be recognized as the same for caching purposes.
|
Cursor? |
query(uri: Uri, projection: Array<String!>?, selection: String?, selectionArgs: Array<String!>?, sortOrder: String?, cancellationSignal: CancellationSignal?)
Query the given URI, returning a Cursor over the result set with optional support for cancellation.
For best performance, the caller should follow these guidelines:
- Provide an explicit projection, to prevent reading data from storage that aren't going to be used.
- Use question mark parameter markers such as 'phone=?' instead of explicit values in the
selection parameter, so that queries that differ only by those values will be recognized as the same for caching purposes.
|
Cursor? |
query(uri: Uri, projection: Array<String!>?, queryArgs: Bundle?, cancellationSignal: CancellationSignal?)
Query the given URI, returning a Cursor over the result set with support for cancellation.
For best performance, the caller should follow these guidelines:
Provide an explicit projection, to prevent reading data from storage that aren't going to be used. Provider must identify which QUERY_ARG_SORT* arguments were honored during the preparation of the result set by including the respective argument keys in the Cursor extras Bundle . See EXTRA_HONORED_ARGS for details.
|
Boolean |
refresh(url: Uri, extras: Bundle?, cancellationSignal: CancellationSignal?)
This allows clients to request an explicit refresh of content identified by uri .
Client code should only invoke this method when there is a strong indication (such as a user initiated pull to refresh gesture) that the content is stale.
|
Unit |
registerContentObserver(uri: Uri, notifyForDescendants: Boolean, observer: ContentObserver)
Register an observer class that gets callbacks when data identified by a given content URI changes.
Starting in android.os.Build.VERSION_CODES#O , all content notifications must be backed by a valid ContentProvider .
|
Unit |
releasePersistableUriPermission(uri: Uri, modeFlags: Int)
Relinquish a persisted URI permission grant. The URI must have been previously made persistent with takePersistableUriPermission(android.net.Uri,int) . Any non-persistent grants to the calling package will remain intact.
|
Unit |
removePeriodicSync(account: Account!, authority: String!, extras: Bundle!)
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 android.Manifest.permission#WRITE_SYNC_SETTINGS .
|
Unit |
removeStatusChangeListener(handle: Any!)
Remove a previously registered status change listener.
|
Unit |
requestSync(account: Account!, authority: String!, extras: Bundle!)
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:
- Integer
- Long
- Boolean
- Float
- Double
- String
- Account
- null
|
Unit |
requestSync(request: SyncRequest!)
Register a sync with the SyncManager. These requests are built using the SyncRequest.Builder .
|
Unit |
setIsSyncable(account: Account!, authority: String!, syncable: Int)
Set whether this account/provider is syncable.
This method requires the caller to hold the permission android.Manifest.permission#WRITE_SYNC_SETTINGS .
|
Unit |
setMasterSyncAutomatically(sync: Boolean)
Sets the global 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 android.Manifest.permission#WRITE_SYNC_SETTINGS .
|
Unit |
setSyncAutomatically(account: Account!, authority: String!, sync: Boolean)
Set whether or not the provider is synced when it receives a network tickle.
This method requires the caller to hold the permission android.Manifest.permission#WRITE_SYNC_SETTINGS .
|
Unit |
startSync(uri: Uri!, extras: Bundle!)
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:
- Integer
- Long
- Boolean
- Float
- Double
- String
- Account
- null
|
Unit |
takePersistableUriPermission(uri: Uri, modeFlags: Int)
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#getPersistedTime() .
|
Uri? |
uncanonicalize(url: Uri)
Given a canonical Uri previously generated by canonicalize , 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.
|
Unit |
unregisterContentObserver(observer: ContentObserver)
Unregisters a change observer.
|
Int |
update(uri: Uri, values: ContentValues?, where: String?, selectionArgs: Array<String!>?)
Update row(s) in a content URI. If the content provider supports transactions the update will be atomic.
|
Int |
update(uri: Uri, values: ContentValues?, extras: Bundle?)
Update row(s) in a content URI. If the content provider supports transactions the update will be atomic.
|
Unit |
validateSyncExtrasBundle(extras: Bundle!)
Check that only values of the following types are in the Bundle:
- Integer
- Long
- Boolean
- Float
- Double
- String
- Account
- null
|
ContentResolver |
wrap(wrapped: ContentProvider)
Create a ContentResolver instance that redirects all its methods to the given ContentProvider .
|
ContentResolver |
wrap(wrapped: ContentProviderClient)
Create a ContentResolver instance that redirects all its methods to the given ContentProviderClient .
|