Programmatically access file sharing link - Google Drive, Android
-
20-12-2019 - |
Question
My application uploads a file into the user's Google Drive (App is authorized with the broadest "Drive" scope). Now I need to obtain a link to the file I just uploaded.
I'm using Java APIs on Android for uploading the file. Couldn't find anything in the API reference relating to links.
P.S. Generation of publicly sharable links are preferred.
Thank you in advance
Solution
Unfortunately, the Google Drive Android API does not support sharing (at least as of now). It's a known limitation.
You can use the REST API instead, (e.g. by doing a POST to https://www.googleapis.com/drive/v2/files/{fileId}/permissions
to insert). See permissions in the API reference.
The fileId
value can be obtained by calling getResourceId()
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow