Google Drive file picker wanted - but get a local file picker

237 Views Asked by At

I want to open a File Picker to selecting Folders in Google Drive. But my File Picker only shows local folders.

Connection to Google Drive is successfully established. I query the root folder of Google Drive and want do open the File Picker on root level immediately after this query.

In my GoogleDriver.class I call the picker like:

Activity.getInstance().openFilePicker(mDriveServiceHelper);

From this Activity I call:

public void openFilePicker(DriveServiceHelper mDriveServiceHelper) {
    if (mDriveServiceHelper != null) {
        Intent pickerIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
        pickerIntent.addCategory(Intent.CATEGORY_DEFAULT);          
        startActivityForResult(pickerIntent, REQUEST_CODE_OPEN_DOCUMENT);
    }
}

IntentFilter in manifest

<intent-filter>
    <action android:name="android.intent.action.OPEN_DOCUMENT_TREE"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="audio/*" />
</intent-filter>

Thanks for supporting me Alejandro

Now the picker opens, but not in Google Drive, it opens locally.

0

There are 0 best solutions below