Getting Started

Before you can begin developing your Drive application, you need to download the Android and Google play Services SDKs and get an Android certificate, as described in the following sections.


Creating a new Android application that uses the Google Drive Android API requires several steps. Many of these steps only have to be perfomed once. The overall process of making a Drive-enabled Android application is as follows:

  1. Install the Android SDK.
  2. Download and configure the Google Play services SDK, which includes the Google Drive Android API.
  3. Register your application. To do this, you need to register a project in the Google Developers Console and get a signing certificate for your app.
  4. Add the required settings to your application's manifest.
  5. Add Drive services to your application. The easiest way to begin is by creating a file.

You may wish to begin by looking at some sample code, some of which is also included with the Google Play services SDK.

Install the Android SDK

As a prerequisite, you need to install the Android SDK. See Get the Android SDK.

Install and configure the Google Play services SDK

You need an Android project for your app before you can complete the steps in this section. If you haven't yet created an Android application, you can follow the tutorial Building Your First App.

The Google Drive Android API is distributed as part of the Google Play services SDK. You can download the Google Play services SDK via the Android SDK Manager. For detailed instructions, see the Google Play services SDK documentation.

Get an Android certificate and register your application

If you haven't already registered your application with the Google Developers Console, then set up a project and application in the Developers Console. The system guides you through the process of choosing or creating a project and registering a new application, and it automatically activates the API for you.

If you've already registered your application with the Developers Console, then follow this procedure instead:

In a terminal, run the Keytool utility to get the SHA1 fingerprint for your digitally signed .apk file's public certificate.
keytool -exportcert -alias androiddebugkey -keystore path-to-debug-or-production-keystore -list -v

The Keytool prints the fingerprint to the shell. For example:

$ keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
Enter keystore password: Type "android" if using debug.keystore
Alias name: androiddebugkey
Creation date: Aug 27, 2012
Entry type: PrivateKeyEntry
Certificate chain length: 1
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 503bd581
Valid from: Mon Aug 27 13:16:01 PDT 2012 until: Wed Aug 20 13:16:01 PDT 2042
Certificate fingerprints:
   MD5:  1B:2B:2D:37:E1:CE:06:8B:A0:F0:73:05:3C:A3:63:DD
   SHA1: D8:AA:43:97:59:EE:C5:95:26:6A:07:EE:1C:37:8E:F4:F0:C8:05:C8
   SHA256: F3:6F:98:51:9A:DF:C3:15:4E:48:4B:0F:91:E3:3C:6A:A0:97:DC:0A:3F:B2:D2:E1:FE:23:57:F5:EB:AC:13:30
   Signature algorithm name: SHA1withRSA
   Version: 3

Copy the SHA1 fingerprint, which is highlighted in the example above.

Next, create credentials appropriate to your project in the Google Developers Console:

  1. Open the Credentials page.
  2. Follow these steps if your application needs to submit authorized requests:

    1. Click Add credentials > OAuth 2.0 client ID.
    2. Select Android.
    3. In the Package name field, enter your Android app's package name.
    4. Paste the SHA1 fingerprint into the form where requested.
    5. Click Create.

    Otherwise, follow the steps below, which are for applications that only need to make unauthorized API calls:

    1. Click Add credentials > API key.
    2. Select Android key.
    3. Paste the SHA1 fingerprint into the form where requested.
    4. Type your Android app's package name into the form where requested.
    5. Click Create.

Create a file in Google Drive

Now you're ready to authorize your application, create a file, and test your app.

Send feedback about...

Drive API for Android
Drive API for Android