How to get Google Drive file ID
16,646
The callback is to the file being created locally. The DriveId will only have a resourceId when the file is synced to the server. Until then getResourceId will return null.
https://developer.android.com/reference/com/google/android/gms/drive/DriveId.html#getResourceId()
Use CompletionEvents to be notified when syncing with the server has occurred. Then calling getResourceId() should deliver what you are expecting.
Comments
-
Konstantin Konopko almost 2 years
I've created a file to Drive root using Google Drive Android API. How can I get this file ID to share it using Google Client Library?
Getting DriveFileResult in
ResultCallback<DriveFileResult>
callback returns Null:String fileId = result.getDriveFile().getDriveId().getResourceId();