Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Google Drive API-已超过下载配额_Android_Google Drive Api - Fatal编程技术网

Android Google Drive API-已超过下载配额

Android Google Drive API-已超过下载配额,android,google-drive-api,Android,Google Drive Api,我得到一个错误: 已超过此文件的下载配额 这是来自驱动器api的响应。我正在尝试通过以下url下载文件: String url = "https://www.googleapis.com/drive/v2/files/" + media.getId() + "?alt=media\n" 我的文件有几MB大,我就是无法下载。我使用scribe和oauth2,创建一个请求,签名并发送它。回复显示签名有效,但我不知道为什么我总是从谷歌得到上面的错误回复 其他事

我得到一个错误:

已超过此文件的下载配额

这是来自驱动器api的响应。我正在尝试通过以下url下载文件:

String url = "https://www.googleapis.com/drive/v2/files/" + media.getId() + "?alt=media\n"
我的文件有几MB大,我就是无法下载。我使用scribe和oauth2,创建一个请求,签名并发送它。回复显示签名有效,但我不知道为什么我总是从谷歌得到上面的错误回复


其他事情,比如检索我所有文件的列表和我的用户,都可以正常工作,并且可以多次工作……

既然您使用的是Android,为什么不尝试使用Java API客户端调用它,如文档部分所述

private static InputStream downloadFile(Drive service, File file) {
    if (file.getDownloadUrl() != null && file.getDownloadUrl().length() > 0) {
        try {
            // uses alt=media query parameter to request content
            return service.files().get(file.getId()).executeMediaAsInputStream();
        } catch (IOException e) {
            // An error occurred.
            e.printStackTrace();
            return null;
        }
    } else {
        // The file doesn't have any content stored on Drive.
        return null;
    }
}
另一种选择是使用
webContentLink
检索下载URL

希望这有帮助

  • 登录

  • 添加云(谷歌硬盘)&登录并允许硬盘

  • 选择文件并共享获取公共url


  • 我将查看Web内容链接提示,谢谢。我不想使用api,我想在我的应用程序中包括许多服务(最终可能超过10个),所以我使用Oauth和Oauth2方法,并使用scribe库。。。我不想让我的应用程序中的谷歌api库、Facebook api库和其他重api库保持小规模。。。为了能够为所有数据源重用几乎所有的代码。。。