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?