【问题标题】:download google document for android, error 403, only binary file can download下载安卓版谷歌文档,错误403,只能下载二进制文件
【发布时间】:2020-07-06 04:46:24
【问题描述】:

如何导出application/documentapplication/spreadsheet 等文件然后下载?我收到以下错误:

403 : 只能下载二进制文件,使用google导出**

if (file.mimeType.contains("document") ||
    file.mimeType.contains("spreadsheet") ||
    file.mimeType.contains("archive") ||
    file.mimeType.contains("text"))
{

    val fileData = FileData(file.name, file.webContentLink ?: "", size
        , isDir = false, extension = file.fileExtension, createdAt = file.createdTime.value.toString())
    fileData.url = Uri.parse(file.webContentLink ?: "")

    ApiDriveHelper.getInstance().readFile(file.id, file.name).addOnCompleteListener {
        Log.e("<<<thanhdocument", "downloaded")
    }.addOnFailureListener({
        Log.e("<<<download fail", it.localizedMessage)
    })
}

【问题讨论】:

    标签: google-sheets-api


    【解决方案1】:

    Google 文档只能存储在 Google Drive 上,不能存储在本地

    要下载,您必须将它们转换为 compatible mime type 并为此使用 Drive API 方法 export,如 Download a Google Document 文档中所述。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-23
      • 2021-07-01
      • 2015-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-13
      相关资源
      最近更新 更多