0

I want to list the files and folders in google drive of any user with my app. I am using the following code:

mGoogleApiClient = new GoogleApiClient.Builder(this)
                        .addApi(Drive.API)
                        .addScope(new Scope("https://www.googleapis.com/auth/drive.readonly"))
                        .addConnectionCallbacks(connectionCallbacks)
                        .addOnConnectionFailedListener(connectionFailedListener)
                        .build();

mGoogleApiClient.connect();

It is resulting ConnectionFailed and showing a dialog is having trouble with Google Play services. But if I replace the GoogleApiClient's scope to .addScope(Drive.SCOPE_FILE) connection is working fine, but resulting no file listing from the google drive. What is problem in my code? Is there any restriction of normal Google API credential regarding scope?

dev_android
  • 8,698
  • 22
  • 91
  • 148
  • I think you did well by using .addScope(Drive.SCOPE_FILE). Did you implement your onConnectionFailedListener and ConnectionCallbacks as stated in this [Android guide](https://developers.google.com/android/guides/api-client) ? – ReyAnthonyRenacia Aug 26 '16 at 10:04
  • 1
    The Google Drive Android API only supports file and appfolder scopes. See here: https://developers.google.com/drive/android/auth#connecting_and_authorizing_the_google_drive_android_api – Anatoli Aug 29 '16 at 08:06

0 Answers0