0

我從Google Drive下載了文件列表。那些文件有不同的mime類似用新的Intent打開Goog​​le Drive文件

"application/vnd.google-apps.folder" 
"application/vnd.google-apps.file" 
"application/pdf" 
"video/mpeg" 
"application/vnd.ms-powerpoint.presentation.macroEnabled.12" 

如何以新的意圖打開這些文件?

也打開文件,我應該使用ID(0B_uvNTGVtbi****zOS1WY78yVlU)或標題(RJ_****_462324_20417.pdf

現在我使用的,但 「Android系統被停止」 :)

Intent myIntent = new Intent(Intent.ACTION_VIEW); 
     myIntent.setData(Uri.parse(localFile.getTitle())); 
     myIntent.setType("*/*"); 
     Intent intent = Intent.createChooser(myIntent, "Choose an application to open with:"); 
    context.startActivity(intent); 
+0

當你說'我有一個列表...'時,請指定一個列表(文件標題,文件ID,...) – seanpj

+0

列出文件和文件夾(不是物理文件)的所有字段,如標題,id,mimetype,最後修改,刪除,盯着等等我通過Google Drive Api獲得的列表。 –

+0

你用什麼API來獲取列表? [GDAA](https://developers.google.com/drive/android/intro)或[REST](https://developers.google.com/drive/web/about-sdk)? – seanpj

回答

0

如果「開幕「這個文件的意思是允許用戶選擇他們應該打開的應用程序,您需要使用驅動器文件的URL併發送一個ACTION_VIEW意圖(參見here瞭解詳細信息)。如果用戶沒有安裝Drive App,則URL將在瀏覽器中打開,否則用戶將獲得在DriveApp或瀏覽器中打開它的選項。

相關問題