简体   繁体   English

Android:驱动应用和Intent。ACTION_GET_CONTENT

[英]Android : Drive app and Intent.ACTION_GET_CONTENT

I would like to import files from Installed Google Drive App to my app using the Intent.ACTION_GET_CONTENT and the mimetype of the intent set to "*/*". 我想使用Intent.ACTION_GET_CONTENT并将Intent的模仿类型设置为“ * / *”将文件从Installed Google Drive App导入到我的应用程序。

I am able to do this with other installed app like Dropbox,Onedrive and box, but not with Google Drive. 我可以使用其他已安装的应用程序(例如Dropbox,Onedrive和Box)来执行此操作,但不能使用Google Drive。 Here is my code : 这是我的代码:

Intent action = new Intent(Intent.ACTION_GET_CONTENT);          
            action.putExtra(Intent.EXTRA_LOCAL_ONLY, true);         
action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
            startActivityForResult(Intent.createChooser(action, "Upload file from..."),Constants.FILE_CHOOSER_REQUEST_CODE );

Thanks. 谢谢。

Very late answer but you need to remove action.putExtra(Intent.EXTRA_LOCAL_ONLY, true); 答案很晚,但是您需要删除action.putExtra(Intent.EXTRA_LOCAL_ONLY, true); in order to see Google Drive option in the picker. 以便在选择器中查看Google云端硬盘选项。

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

相关问题 与Google云端硬盘一起使用Intent.ACTION_GET_CONTENT - Intent.ACTION_GET_CONTENT with Google Drive 在android中使用Intent.ACTION_GET_CONTENT时是否可以隐藏谷歌驱动器? - Is it possible to hide google drive while using Intent.ACTION_GET_CONTENT in android? Android-将Intent.ACTION_GET_CONTENT限制为特定的文件扩展名 - Android - Limit Intent.ACTION_GET_CONTENT to a specific file extension 无法在Intent上选择文件。ACTION_GET_CONTENT - Files are not selectable on Intent.ACTION_GET_CONTENT Android - 如何使 Intent(Intent.ACTION_GET_CONTENT) 与 singleInstance 活动一起工作? - Android - How to make Intent(Intent.ACTION_GET_CONTENT) work with singleInstance Activity? 如何提供ArrayList <Uri> Intent的内容。ACTION_GET_CONTENT - How to provide ArrayList<Uri> content for Intent.ACTION_GET_CONTENT 如何为Intent.ACTION_GET_CONTENT提供内容 - How to provide content for Intent.ACTION_GET_CONTENT Android 4.4 (KitKat) 上的 Android Gallery 为 Intent.ACTION_GET_CONTENT 返回不同的 URI - Android Gallery on Android 4.4 (KitKat) returns different URI for Intent.ACTION_GET_CONTENT 仅获取图库文件夹:Intent.ACTION_GET_CONTENT - Get only gallery folder : Intent.ACTION_GET_CONTENT Intent.ACTION_GET_CONTENT 在应用程序的不同风格的图库中打开不同的文件夹 - Intent.ACTION_GET_CONTENT opens different folder in Gallery on different flavours of the app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM