Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exclude the google drive option in browsing files through intent in android

this is a asked question but i did not solve it using that solution. Here is my code

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getDownloadCacheDirectory().getPath().toString());
intent.setDataAndType(uri,"*/*");
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
intent.addCategory(Intent.CATEGORY_OPENABLE);
try {
    startActivityForResult(Intent.createChooser(intent, "SELECT FILE"), commonUtilities.FILE_REQUEST_CODE);
} catch (ActivityNotFoundException e) {
}

Still Google drive options is there. I just want not to display the google drive option.

How can i get that , Help me out. Thank in adv

like image 761
manjari Avatar asked Oct 30 '22 00:10

manjari


1 Answers

I just want not to display the google drive option.

What you want is not important. What your users want is important. Some of your users may want to get content from Google Drive, file servers on the local network, and other places that they have configured on their device that support ACTION_GET_CONTENT.

Beyond that, in general, you cannot control what options ACTION_GET_CONTENT provides to users.

So, if you do not want Google Drive to appear as an option, do not use ACTION_GET_CONTENT (or ACTION_OPEN_DOCUMENT, ACTION_CREATE_DOCUMENT, etc.). Do something else, such as integrate a file-picker library.

like image 167
CommonsWare Avatar answered Nov 15 '22 05:11

CommonsWare