0

I want to be able to

  • select a folder in Google Drive (alternatively, I can just Copy/Paste the Drive ID because this application is only for my needs for the moment)
  • Read files metadata in this folder
  • Download content of those files (spreadsheet)

I tried to use Google Drive API which is pretty simple, but this restriction is a problem for me:

Note: The Android Drive API only works with the https://www.googleapis.com/auth/drive.file scope. This means that only files which a user has opened or created with your application can be matched by a query.

Indeed, the Drive folder and files (spreadsheet) I want to read or download are not created by the application. https://www.googleapis.com/auth/drive.readonly would be perfect for my needs, but it’s only usable with Google Drive REST API.

This is where my problems begins:

First, I tried to run the REST DEMO Master project. With some updates in the gradle it works fine. So, I tried to create a new project (API 23, no activity) and I simply copy/paste files from REST DEMO Master project. I ran this new project and it threw this exception:

UNSPECIFIED GOOGLE DRIVE FAILURE - the name must not be empty: null

As the code is the same, I suppose that the problem comes from conflicts between API Version or project configuration (I’m pretty new to android development and not comfortable with Gradle), and I can't use this code in my existing project.

I read this thread (and many others), I spent hours trying different solutions but I’m really stuck and I can’t find a way to make that work.

What is the best way to connect to a GDrive folder and read content of files not created by the application? Any help would be really appreciated!

NB: I generated the signing certificate fingerprint (SHA1) and registered the application.

Jacque
  • 757
  • 4
  • 9
flzox
  • 1
  • I found a documentation regarding [Authorizing and Using REST APIs](https://developers.google.com/android/guides/http-auth#use_the_google-provided_authorization_ui_for_rest_api_access), you can start with this.You can find the complete REST API sample code included in the Google Sign-In Quickstart on Github: [RestApiActivity.java](https://github.com/googlesamples/google-services/blob/master/android/signin/app/src/main/java/com/google/samples/quickstart/signin/RestApiActivity.java). – Mr.Rebot Nov 16 '18 at 07:24
  • Thank you for the Google Sign-In Quickstart sample code, it really helped ! Problem solved :) – flzox Nov 20 '18 at 19:54

0 Answers0