I have uploaded a text file to my google drive account and it is public. I got the link for that file by the share link.
What I want to do is to download that file from the drive using drive API by using the link that I obtained. And then store that file in the internal storage of the users mobile for future use. How do I accomplish this using the API?
I have registered my project in google developer console and I have created a public API access for my project.
Please guide me as to what I need to do to get the file.
There are 2 different APIs to access Google Drive from Android. The GDAA and the REST API. You need he REST since GDAA supports only FILE scope (i.e. can only see files/folders the Android app created).
Assuming you are asking about the 'shareable link' that looks like this:
the URL portion below (most of the original is replaced by dots, to keep my stuff private):
is the actual (resource) ID that is used in REST to retrieve files, folders. See this snippet:
taken out of context from the REST class of the GDAA/REST demo here.
You don't need bother with the demo, you can test it in the playground here (bottom of the page).
Good Luck