java.lang.Object | |
↳ | com.google.android.gms.drive.Drive |
The Drive API provides easy access to users' Google Drive contents. This API includes Activities to open or create files in users' Drives, as well as the ability to programmatically interact with contents, metadata, and the folder hierarchy.
Create a client DriveClient
or DriveResourceClient
to start interacting with
Drive. The DriveClient
provides access to basic Drive functionality, and the DriveResourceClient
provides access to methods that interact with DriveResource
objects.
Clients can be created with any of the following methods:
getDriveClient(Activity, GoogleSignInAccount)
getDriveClient(Context, GoogleSignInAccount)
getDriveResourceClient(Activity, GoogleSignInAccount)
getDriveResourceClient(Context, GoogleSignInAccount)
Be sure to pass in at least one of SCOPE_FILE
or SCOPE_APPFOLDER
when
creating the GoogleSignInAccount
.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
API | This field is deprecated. This is no longer necessary to provide. | ||||||||||
DriveApi | This field is deprecated. Gain access to the Drive API with one of the get*Client() methods instead. | ||||||||||
DrivePreferencesApi | This field is deprecated. Gain access to the Drive API with one of the get*Client() methods instead. | ||||||||||
SCOPE_APPFOLDER | A Scope that gives 'drive.appfolder' access to a user's drive. | ||||||||||
SCOPE_FILE | A Scope that gives 'drive.file' access to a user's drive. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new instance of
DriveClient for use in an Activity . | |||||||||||
Creates a new instance of
DriveClient for use in a non-Activity Context . | |||||||||||
Creates a new instance of
DriveResourceClient for use in an Activity . | |||||||||||
Creates a new instance of
DriveResourceClient for use in a non-Activity Context . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
This field is deprecated.
This is no longer necessary to provide.
The API necessary to use Drive. Provide this as an API to addApi(Api)
.
This field is deprecated.
Gain access to the Drive API with one of the get*Client() methods instead.
The entry point for interacting with the Drive APIs which provides ways to access/update the files and folders in users Drive.
This field is deprecated.
Gain access to the Drive API with one of the get*Client() methods instead.
The entry point for interacting with the Drive APIs which provides ways to access/update Drive preferences.
A Scope that gives 'drive.appfolder' access to a user's drive. This scope gives access to files that have been created by the app in the App Folder.
This scope can be provided in requestScopes(Scope, Scope)
A Scope that gives 'drive.file' access to a user's drive. This scope give per-file access to files that have been created by, or specifically opened with the app.
This scope can be provided in requestScopes(Scope, Scope)
Creates a new instance of DriveClient
for use in an Activity
. Error resolutions
will be automatically launched from the provided Activity
, displaying UI when
necessary. This is the entry point for basic interactions with the Drive API.
Parameters | |
---|---|
activity |
Activity |
account |
GoogleSignInAccount |
Returns | |
---|---|
DriveClient |
Creates a new instance of DriveClient
for use in a non-Activity Context
. Error
resolutions will be automatically launched from the provided Context
, displaying system
tray notifications when necessary. This is the entry point for basic interactions with the
Drive API.
Parameters | |
---|---|
context |
Context |
account |
GoogleSignInAccount |
Returns | |
---|---|
DriveClient |
Creates a new instance of DriveResourceClient
for use in an Activity
. Error
resolutions will be automatically launched from the provided Activity
, displaying UI
when necessary. This is the entry point for general management of all DriveResource
objects with the Drive API.
Parameters | |
---|---|
activity |
Activity |
account |
GoogleSignInAccount |
Returns | |
---|---|
DriveResourceClient |
Creates a new instance of DriveResourceClient
for use in a non-Activity Context
. Error resolutions will be automatically launched from the provided Context
,
displaying system tray notifications when necessary. This is the entry point for general
management of all DriveResource
objects with the Drive API.
Parameters | |
---|---|
context |
Context |
account |
GoogleSignInAccount |
Returns | |
---|---|
DriveResourceClient |