download google document for android, error 403, only binary file can download

Viewed 46

How can I export files like application/document, application/spreadsheet and then download them? I get the following error:

403 : only binary file can download, use google export**

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)
    })
}
1 Answers
Related