在Android上使用Google云端硬盘打开Goog​​le doc文件

时间:2014-11-24 06:20:22

标签: android google-drive-api google-drive-android-api

我无法将Google docs file链接传递给android上的Google Drive App

是否可以通过传递意图链接在Google云端硬盘Android应用上打开Goog​​le云端硬盘文件?

Private void open(){
  String link = "https://docs.google.com/file/d/"+FILE_ID;
  Uri path = Uri.parse(link);
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setDataAndType(path, MIME_TYPE);
  intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  try {
       startActivity(intent);
      } catch (Exception e) {
    showMessage(e.getMessage());
     }
      }

0 个答案:

没有答案
相关问题