如何从android中的Google驱动器下载mp3文件 [英] How to Download mp3 file from google drive in android

查看:93
本文介绍了如何从android中的Google驱动器下载mp3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Android应用程序,在该应用程序中,我必须从Google驱动器下载音频文件,然后将这些文件保存在SD卡中.是否有任何API或示例项目可以帮助我从Google驱动器下载mp3文件

或 还有其他方法可以通过编程方式从Google驱动器下载mp3文件...

我们可以使用可下载的公共网址来实现上述目的

谢谢

解决方案

有两个API可以帮助您做到这一点. GDAA REST游乐场(底部)进行测试互动地互动

此外,您可以在此处使用演示代码来查看使用一个代码的(缺点)优势API或其他.它处理的是jpg内容而不是mp3,但是它具有您需要的所有构造块.确保您了解DriveId的关系和ResourceId.

祝你好运

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

这篇关于如何从android中的Google驱动器下载mp3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆