DriveClient

  • TheDriveClient class and the Google Drive Android API are deprecated and will be turned down on December 6, 2019.

  • Developers should migrate to the REST API for continued Drive interactions.

  • TheDriveClient provides methods for basic interactions with the Drive API, such as getting Drive IDs, managing upload preferences, and starting file creation/opening activities.

  • All methods within theDriveClient class are also deprecated.

public abstract classDriveClient extendsGoogleApi<Drive.ConnectionlessDriveOptions>

This class is deprecated.
The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.

Client for basic interactions with the Drive API.

Inherited Field Summary

From class com.google.android.gms.common.api.GoogleApi
protected final GoogleApiManagerzabm

Public Method Summary

abstractTask<DriveId>
getDriveId(String resourceId)
This method is deprecated. The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.
abstractTask<TransferPreferences>
getUploadPreferences()
This method is deprecated. The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.
abstractTask<IntentSender>
newCreateFileActivityIntentSender(CreateFileActivityOptions options)
This method is deprecated. The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.
abstractTask<IntentSender>
newOpenFileActivityIntentSender(OpenFileActivityOptions options)
This method is deprecated. The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.
abstractTask<Void>
requestSync()
This method is deprecated. The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.
abstractTask<Void>
setUploadPreferences(TransferPreferences transferPreferences)
This method is deprecated. The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.

Inherited Method Summary

From class com.google.android.gms.common.api.GoogleApi
GoogleApiClient
asGoogleApiClient()
ClientSettings.Builder
createClientSettingsBuilder()
Task<Boolean>
disconnectService()
<A extends Api.AnyClient, T extends ApiMethodImpl<? extends Result, A>> T
doBestEffortWrite(ApiMethodImpl arg0)
<TResult, A extends Api.AnyClient>Task<TResult>
doBestEffortWrite(TaskApiCall<A, TResult> arg0)
<A extends Api.AnyClient, T extends ApiMethodImpl<? extends Result, A>> T
doRead(ApiMethodImpl arg0)
<TResult, A extends Api.AnyClient>Task<TResult>
doRead(TaskApiCall<A, TResult> arg0)
<A extends Api.AnyClient>Task<Void>
doRegisterEventListener(RegistrationMethods arg0)
<A extends Api.AnyClient, T extends RegisterListenerMethod<A, ?>, U extends UnregisterListenerMethod<A, ?>>Task<Void>
doRegisterEventListener(RegisterListenerMethod arg0, UnregisterListenerMethod arg1)
Task<Boolean>
doUnregisterEventListener(ListenerKey arg0)
<TResult, A extends Api.AnyClient>Task<TResult>
doWrite(TaskApiCall<A, TResult> arg0)
<A extends Api.AnyClient, T extends ApiMethodImpl<? extends Result, A>> T
doWrite(ApiMethodImpl arg0)
finalApi<Drive.ConnectionlessDriveOptions>
getApi()
Drive.ConnectionlessDriveOptions
getApiOptions()
Context
getApplicationContext()
final int
getInstanceId()
Looper
getLooper()
<L> ListenerHolder<L>
registerListener(Object arg0,String arg1)
zace
zaa(Context arg0,Handler arg1)
Api.Client
final zai<Drive.ConnectionlessDriveOptions>
zak()
From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

Public Methods

public abstractTask<DriveId>getDriveId(String resourceId)

This method is deprecated.
The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.

Returns theDriveId associated with the providedresourceId. This Drive ID can be used to retrieve the Drive file or folder, viaasDriveFile() orasDriveFolder().

public abstractTask<TransferPreferences>getUploadPreferences()

This method is deprecated.
The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.

Returns theTransferPreferences for file uploads performed by the calling application. These preferences dictate how files that are created or edited by the application are uploaded to the server from the device.

public abstractTask<IntentSender>newCreateFileActivityIntentSender(CreateFileActivityOptions options)

This method is deprecated.
The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.

Creates anIntentSender that can be used to start a dialog activity with the specifiedoptions that allows the user to create a new file in his/her Drive.

Once the user has chosen to create the new file, itsDriveId can be retrieved via the extra EXTRA_RESPONSE_DRIVE_ID.

Note: You must use#startIntentSenderForResult to invoke the activity.

This method requires authorization withSCOPE_FILE.

public abstractTask<IntentSender>newOpenFileActivityIntentSender(OpenFileActivityOptions options)

This method is deprecated.
The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.

Creates anIntentSender that can be used to start a dialog activity with the specifiedoptions that allows the user to open an existing file.

Once the user has selected a file, theDriveId of that file can be retrieved via the extra EXTRA_RESPONSE_DRIVE_ID. The file is also automatically authorized for access by the calling application.

Note: You must use#startIntentSenderForResult to invoke the activity.

This method requires authorization withSCOPE_FILE.

public abstractTask<Void>requestSync()

This method is deprecated.
The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.

Requests synchronization with the server to download any metadata changes that have occurred since the last sync with the server.

Typically, this method should be called when the user requests a refresh of their list of files. Once this method returns, performing a query will return fresh results.

In order to avoid excessive load on the device and server, sync requests are rate-limited to approximately one request per minute. If the request has been rate-limited, the operation will fail with the DRIVE_RATE_LIMIT_EXCEEDED status. This indicates that a sync has already occurred recently so there is no need for another. After a sufficient backoff duration, the operation will succeed when re-attempted.

public abstractTask<Void>setUploadPreferences(TransferPreferences transferPreferences)

This method is deprecated.
The Google Drive Android API is deprecated and will be turned down on December 6, 2019. See themigration guide for instructions on migrating to the REST API.

Sets theTransferPreferences for file uploads performed by the calling application to the specifiedtransferPreferences and returns the status of the operation. These preferences dictate how files that are created or edited by the application are uploaded to the server from the device.

If the application regularly uploads large files to the user's Drive, it is advisable to use these preferences to control when the files should be uploaded, based on network connectivity, battery usage, etc.

Note: Preferences will be applied to both future and pending file uploads performed by the application. For example, if the application sets the preferences to upload files only on WiFi then tries to upload a file while the device is on mobile data, the file will not be uploaded; however, if the application later changes the preferences to upload files on WiFi or mobile data, then the file will be scheduled for upload at that time.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.