Malin
Malin

Reputation: 685

Android, how to get "fileID" from Google Drive File picker

In my android app, Im asking the user to select a file from his google drive. I can load the "file picker" correctly, but what I really need is the fileId for the file that the used selected.

I've looked into Drive, DriveId, Metadata etc.. but cant find out how to do it.

How do I find the fileId of a file that the user selected from Google Drive?

Upvotes: 1

Views: 1091

Answers (1)

Malin
Malin

Reputation: 685

Figured it out!

DriveId is the id of the folder, to get fileId:

String fileId = DriveId.getResouceId();

NOTE! Google's code for Google Drive on github, (link below), tries to do this, but is actually wrong!! The fileId is your driveId.getResouceId();

https://github.com/googledrive/android-demos/blob/master/src/com/google/android/gms/drive/sample/demo/PickFileWithOpenerActivity.java

Upvotes: 1

Related Questions