Create a New Project on Google Developer Console
To integrate Android application with Google Drive, create the credentials of project in the Google Developers Console. So, we need to create a project on Google Developer console.
To create a project on Google Developer Console, follow these steps:
Go to Google Developer Console for Android. Fill your project name in the input field and click on the create button to create a new project on Google Developer console.
We need to create credentials to access API. So, click on the Create credentials button.
Now, a pop window will open. Click on API Key option in the list to create API key.
We need an API key to call Google APIs for Android. So, click on the Android Key to identify your Android Project.
Next, we need to add Package Name of the Android Project and SHA-1 fingerprint in the input fields to create API key.
We need to generate SHA-1 fingerprint. So, open your terminal and run Keytool utility to get the SHA1 fingerprint. While running Keytool utility, you need to provide keystore password. Default development keytool password is “android”. keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
Now, add Package name and SHA-1 fingerprint in input fields on credentials page. Finally, click on create button to create API key.
This will create API key for Android. We will use the this API key to integrate Android application with Google Drive.
Enable Google Drive API
We need to enable Google Drive Api to access files stored on Google Drive from Android application. To enable Google Drive API, follow below steps:
Go to your Google Developer console Dashboard and click on Enable APIs get credentials like keys then you will see popular Google APIs.
Click on Drive API link to open overview page of Google Drive API.
Click on the Enable button to enable Google drive API. It allows client access to Google Drive.
Add Internet Permission
App needs Internet access Google Drive files. Use the following code to set up Internet permissions in AndroidManifest.xml file :
<uses-permission android:name="android.permission.INTERNET" />
Add Google Play Services