This API is deprecated. Clients must migrate to the Drive REST API or another suitable solution to avoid disruptions to your application.

Introduction to the Google Drive Android API

The Drive Android API is a native API that conforms to standard Android best practices and coding conventions. It is an improvement over the generated client API, simplifying many common tasks associated with using the Drive service on mobile devices. The API automatically handles previously complex tasks such as offline access and syncing files. This allows you to read and write files as if Drive were a local file system.

The Drive Android API also significantly reduces the installed size of Drive-enabled apps. Because the API is part of the Google Play services client library, you no longer need to compile your app using the Google APIs Client Library for Java in order to access the Drive service.


This documentation assumes you are familiar with Android development and object-oriented programming concepts. You should also be familiar with Google Drive from a user's point of view.

API Overview

The Google Drive Android API provides abstractions for managing file content and metadata. Files are represented by the DriveFile interface; folders by the DriveFolder interface. Both share a common superinterface, DriveResource, which contains a DriveId. This is the unique identifier for all files and folders.

The API also includes a package for querying for files based on metadata attributes, such as the title.

Resource metadata

Metadata for resources are encapsulated in the Metadata class that contains all details about a file or folder including the title, the MIME type, and whether the file is editable, starred or trashed. The Metadata is fetched for a DriveResource by calling the DriveResourceClient.getMetadata() method.

The Metadata may be set or changed when creating or updating a file using a MetadataChangeSet and setting the appropriate values, then calling the DriveResourceClient.updateMetadata() method.

For more information, see Working with Metadata.


You can open files programmatically using the DriveResourceClient.openFile() method or by allowing the user to select a file using a file selector activity created with the DriveClient.newOpenFileActivityIntentSender() method. The file contains a reference to the contents of the file, encapsulated in the DriveContents class, which provides access to read and write the underlying data. You can read the contents of a drive file by accessing an input stream of its contents by calling DriveContents.getInputStream().

To create a file, you can use either the DriveResourceClient.createFile method or the DriveClient.newCreateFileActivityIntentSender() method, which presents a dialog to the user that allows them to create the new file in their Drive.

For more information about how to work with files, see Working with File Contents. For more information about how to create files, see Creating Files


The Drive for Android API has several methods for manipulating folders:

  • DriveResourceClient.createFolder(), DriveResourceClient.createFile(), methods for creating folders or files, respectively, within a folder
  • DriveResourceClient.listChildren(), DriveResourceClient.queryChildren() methods for listing or querying the children of a folder.

For more information, see Working with Folders.

Activity Builders

The Drive for Android API has two methods that implement UI components to simplify common tasks associated with opening and creating files.

DriveClient.newCreateFileActivityIntentSender() method helps you quickly create a file, set its initial folder, title, contents, and metadata. The class also implements a simple UI that allows a user to specify the file's title and destination folder. For more information, see Creating Files.

DriveClient.newOpenFileActivityIntentSender() method helps you easily open a file selected by the user. The class displays a simple UI to let the user navigate and select from a list of files that match the specified MIME types. When you invoke the class, you specify an initial folder where the user's navigation begins. You can also specify a preferred set of MIME types for the file list.


Queries allow you to search for specific files or folders based on their metadata attributes, such as the title. Queries are represented by the Query class and can be constructed using the Query.Builder class.

For more information, see Querying for Files.

Developer Resources

In addition to the sample code bundled with the Google Play services SDK, many more examples can be found at the official Google Drive GitHub repository.