简体   繁体   中英

How to Download mp3 file from google drive in android

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

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:

  1. 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.
  2. Download the content as a binary stream.
  3. 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

Go to Developers Google Website click here

you will get information how to download file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM