android - 以编程方式打开 Google 云端硬盘中的文件,而不使用 Drive API

标签 android google-drive-api

我有一个接收 Google 云端硬盘文件 URL 的应用程序。像这样的事情:

https://docs.google.com/a/spreadsheet/ccc?key=0AoDnOTP7MiABdF9VSEFNMktmeDY4MkNHS3NDdk5JMmc#gid=0

我仍然不确定是完整的 https url 还是只是键值

我需要做两件事:

1) 检查手机中是否安装了 Android 版 Google Drive 应用程序。

2) 使用该 URL 调用 Google Drive Android 应用程序来打开文件。理想的方法是不打开任何网络浏览器。我想使用类似 Intent 之类的附加功能,这可能吗?

感谢您的帮助,并对我糟糕的英语表示歉意

最佳答案

别担心,现在很容易,我有解决这个问题的方法。如果您想打开从云端硬盘检索的任何文件,则可以使用 Google 云端硬盘应用程序的资源轻松完成此操作。首先从 Play Market 安装 Google Drive 应用程序 Install Google Drive app

之后使用此代码打开您的文件。

   FileID=file.getId();//it is your file ID which you want to display

  String url = "https://docs.google.com/file/d/"+FileID;
  Intent i = new Intent(Intent.ACTION_VIEW);
  i.setData(Uri.parse(url));
   startActivity(i);

This will open your file of any type(image, pdf,doc,txt etc)

关于android - 以编程方式打开 Google 云端硬盘中的文件,而不使用 Drive API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20843262/

相关文章:

java - Android 自动调用检查互联网连接

android - 如何将 hashmap 值保存到 sharedpreference?

java - Spinner OnItemSelected 事件未被调用

Android,如何在我的代码中的 TabButton 中添加图标

java - 无法从 ArrayList 创建 ArrayAdaptor

php - 您如何构造 URL 来访问 google docs/drive 文件夹?

javascript - 共享文件用户无法使用Google Drive API中的drive.file范围访问文件

java - 谷歌云端硬盘 API : How can I have an access token without asking for Authorization everytime

google-drive-api - 相当于Google Doc文件的File.md5Checksum

oauth - 从 Chrome 扩展程序访问 Google 文档