问题
I am working on Android application in which i have to download audio files from google drive and then save these files in sd-card.. Is there any api or sample project that helps me in downloading mp3 files from google drive
OR Is there any other way to to download mp3 file from google drive programatically...
Can we use public downloadable url for achieving above mentioned purpose
Thanks
回答1:
There are two a APIs that that allow you to do it. The GDAA and the REST. None of them deals with the mp3 files specifically, though. The APIs deal with a binary file content only. That means you:
- Find the file first. Either you know the name, mime type,... or you know it's Id. If you use REST, the Id can be extracted from the file's URL.
- Download the content as a binary stream.
- Save the content as an mp3 file on Android.
If you insist on applying the URL based Id, it is easier to use the REST, since:
- the URL directly corresponds with the REST Id (aka ResourceId in GDAA)
- you can use the REST playground (bottom) to test things interactively
Also, you may use the demo code here to see the (dis)advantages of using one API or another. It deals with jpg content instead of mp3, but it has all the building blocks you need. Be sure you understand the relation of DriveId and ResourceId.
Good Luck
回答2:
Go to Developers Google Website click here
you will get information how to download file.
来源:https://stackoverflow.com/questions/29343041/how-to-download-mp3-file-from-google-drive-in-android