[英]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.