简体   繁体   English

从Google Drive API下载任何文件

[英]Download any file from Google Drive API

I'm a Google Drive API rookie. 我是Google Drive API的新秀。 In my app, I integrate Google Drive Api to allows user search in its Drive folders an specific extension files (.gpx). 在我的应用程序中,我集成了Google Drive Api,以允许用户在其Drive文件夹中搜索特定的扩展名文件(.gpx)。 I use newOpenFileActivityBuilder() in IntentSender, so user can pick the file he wants. 我在IntentSender中使用newOpenFileActivityBuilder(),因此用户可以选择他想要的文件。

String[] mimeTypes = {"unknown/unknown","application/octet-stream","application/type"};

IntentSender intentSender = Drive.DriveApi
            .newOpenFileActivityBuilder()
            .setMimeType(mimeTypes)
            .build(gDriveclient);

My problem is the .gpx files are not selectable, I have tried a lot of different mime types, but none works. 我的问题是.gpx文件是不可选择的,我尝试了很多不同的mime类型,但是没有一个起作用。

Any idea? 任何想法? Thanks in advance! 提前致谢!

You need to provide the MIME type for the .gpx file. 您需要为.gpx文件提供MIME类型。 You could find it out by looking at the MIME type in the get response: https://developers.google.com/drive/v2/reference/files/get 您可以通过查看get响应中的MIME类型来找出答案: https : //developers.google.com/drive/v2/reference/files/get

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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