How to select files from google drive in android?

后端 未结 2 2023
不知归路
不知归路 2021-02-15 23:40

Is there any way to start file picker for google drive in android app - to do something similar to this http://googleappsdeveloper.blogspot.com/2012/08/allowing-user-to-select-g

2条回答
  •  再見小時候
    2021-02-16 00:25

    Yes, there is a file picker in the GDAA. The best place to see it's use is this demo, specifically the Intents section.

    There are 2 methods in the demo you are interested in:

    1. the 'Pick a file with opener activity' ,
    2. and the 'Pick a folder with opener activity'

    but they are essentially the same, differing only in the MIME TYPE filter specified here:

    IntentSender intentSender = Drive.DriveApi.newOpenFileActivityBuilder()
     .setMimeType(new String[] { DriveFolder.MIME_TYPE })  // <--- FOLDER
     //.setMimeType(new String[] { "text/plain", "text/html" }) // <- TEXT FILES
     .build(getGoogleApiClient());
    

    Good Luck

提交回复
热议问题