I am trying to run the following code (taken largely from Stephen Wylie):
package com.googledrive.googledriveapp;
// For Google Drive / Play Services
// Vers
EDITED: Sorry I just realized that we can sign the apk in debugging mode using debug.keystore. SO, the most important thing is insert the correct SHA1 key in your Google API console. (generated using the JRE7 tool as mentioned by Stephen Wylie in his Google+ post)
Also see (developer.android.com/tools/publishing/app-signing.html#debugmode) for the keystore password
After some trial and error, I finally able to list files in my google drive Although I am not sure whether this is the most correct answer, but at least I am able to list files now
First, please refer to Stephen Wylie updated Google+ post https://plus.google.com/u/0/114042449736049687152/posts/CD3L8zcJg5Z
generate the SHA1 key with your .keystore using the JRE7 tool
I am using the .keystore file that I had been using with my google play store (If you do not have any keystore, you can go to your project, click export, then it will request you to create a .keystore file)
with the generated SHA1 key, go to your Google API console (it is best if you start from fresh, delete the current project and start a new one)
-enable Drive API
-enable Drive SDK
-go to API ACCESS
-create CLIENT ID
-IMPORTANT here, choose Installed application & Android
-ALSO IMPORTANT, key in your generated SHA1 key
-key in your CORRECT package name (com.example.xxx) that you are using in your eclipse project
-Go to Drive SDK tab -upload icon
-IMPORTANT, key in your CLIENT ID (Client ID for installed applications) from the API Access tab
-Insert 3 scopes mentioned in Stephen Wylie post, [/userinfo.email, /userinfo.profile, /auth/drive]
-Insert an URL
-Tick Multiple File Support
Again, make sure your package name in your code is same as the package name you inserted into Google API Console
Finally, in eclipse, export your project using the .keystore file you created just now
Put the exported APK file into your phone, install and try.
Check your LogCat to show the listed files from your Google Drive
I had succeeded using this way.
EDITED: If you generated the SHA1 key with the debug.keystore, you can skip the "Export" part. Just debug your application is OK. Eclipse will automatically sign the apk with debug.keystore.
EDITED: Next time your code is ready, you need to generate a new SHA1 key with your real .keystore, then input into the Google API console.
EDITED 2: Make sure your manifest include these
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
I encountered this issue as well and soon realized I had enabled the wrong 'service' under 'Google API Console > Services'. Try your application after enabling 'Drive API' instead of 'Drive SDK'.
Steps:
1) Go to https://code.google.com/apis/console
2) Select the correct application / project from the dropdown
3) Go to 'Services'
4) Switch 'ON' 'Drive API'