Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restrict Google drive option from not appearing while selecting file or image in Android below API level 19?

I am newbie in Android and I have a requirement for selecting files on devices below API level 19.

I have tried

private void chooseFile() {
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
             intent.setType("application/pdf|file");
        } else {
             intent.setType("image/*|application/pdf");
        }
        startActivityForResult(intent, PICKFILE_REQUEST_CODE);
}

Now I do not want Google drive to appear as an option and I want file-manager as an option. I want to do this with intents.

Can any one suggest how can I achieve this?

like image 237
Vivek Pratap Singh Avatar asked Dec 16 '15 10:12

Vivek Pratap Singh


People also ask

How do I disable Google Drive?

In the “preferences” window, click on the “Google Drive” tab, find a box labeled “sync my drive to this computer” and uncheck it. This will pause syncing until you turn it back on. Uncheck the first box in the “Google Drive” tab to disable syncing.

Can you restrict Google Drive downloads?

If you're sharing a Google Drive file that you own, which has sensitive content, you can stop people from re-sharing, downloading, printing, or copying the file or changing access permissions.


2 Answers

 Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
 //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
 intent.setType("application/pdf");
 startActivityForResult(intent, PICKFILE_REQUEST_CODE);

This will work for me to avoid gdrive from chooser

like image 169
Sumit Bandekar Avatar answered Sep 29 '22 14:09

Sumit Bandekar


Have you tried

intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
like image 45
MSpeed Avatar answered Sep 29 '22 15:09

MSpeed