SHARE INTENT Intent.createChooser: How to display all installed file browser apps?

399 views Asked by At

I want to display all installed file browser apps when the user press a button "browse files" in my app, but without passing it any file, I just want to open a file browser. Also I don't want to wait for a file chooser or any other result. I just want to display the user apps installed for browse his files.

I tried this:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivity(Intent.createChooser(intent, getString(R.string.select_file_browser)));

It should display to the user all the file explorer apps installed in the device, which has three, but is not displaying them. The device is just opening the default "FILES" google default app installed in the device.

How can I solve this?

Is Intent.ACTION_GET_CONTENT the correct intent for this purpose?

1

There are 1 answers

0
blackapps On

The package name of the Files app (on modern Android devices available) is

com.google.android.apps.nbu.files

You can obtain a launch intent for a package name and then use start activity.

String packageName = "com.google.android.apps.nbu.files";

Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName);

startActivity(intent);

Be shure to catch a lot of possible exceptions.

Knowing a package name you can start every app in this way.