简体   繁体   中英

Is it possible to hide google drive while using Intent.ACTION_GET_CONTENT in android?

I have tried to open a file manager with mentioned code but I don't want to visible google drive option in the navigation bar.

I have tried the different solution but still, I didn't get my solution and wondering Is it possible or not?

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
intent.setType("*/*");
startActivityForResult(Intent.createChooser(intent, "Select a File 
to Upload"),FILE_SELECT_CODE);

Try like this.

 private static final int FILE_SELECT_CODE = 0;

 private void showFileChooser() {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 
    intent.setType("*/*"); 
    intent.addCategory(Intent.CATEGORY_OPENABLE);

    try {
    startActivityForResult(
            Intent.createChooser(intent, "Select a File to Upload"),
            FILE_SELECT_CODE);
    } catch (android.content.ActivityNotFoundException ex) {
        // handle exception
    }
}

Is it possible or not?

There is no documented and supported means for doing this. There could be dozens of apps all supporting ACTION_GET_CONTENT / ACTION_OPEN_DOCUMENT . Whether Google Drive is among them is largely up to the user.

EXTRA_LOCAL_ONLY may limit the number of contributing apps, but cloud storage providers (like Google Drive) may have locally-cached documents that they still make available even for "local-only" requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM