2

I'm trying to fetch details of all browsers in the device using PackageManager.

Here is something I have tried.

    PackageManager pm = context.getPackageManager();
        // Get default VIEW intent handler.
    Intent activityIntent = new Intent(Intent.ACTION_VIEW, 
    Uri.parse(url));

        // Get all apps that can handle VIEW intents.
    List resolvedActivityList = 
                 pm.queryIntentActivities(activityIntent, 0);

But, it is returning only one app details i.e., my default browser info.

kiran puppala
  • 689
  • 8
  • 17
  • So what you want ? all browsers installed in device ? if yes than this is the way to do this https://stackoverflow.com/a/10512929/3514144 and https://stackoverflow.com/a/43306157/3514144 – Ajay Pandya Jul 27 '19 at 04:50
  • Check this **Kotlin** answer: [If you need to show only email apps and then you want to open only inbox (not open new email writing), you just need to use below function.](https://stackoverflow.com/a/70441024/8471798) – canerkaseler Dec 21 '21 at 20:49

1 Answers1

4

I found solution for this.

Starting from api level 23, from android docs

public static final int MATCH_ALL Querying flag: if set and if the platform is doing any filtering of the results, then the filtering will not happen. This is a synonym for saying that all results should be returned.

List resolvedActivityList;
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    resolvedActivityList = 
                 pm.queryIntentActivities(activityIntent,PackageManager.MATCH_ALL );
} else {
    resolvedActivityList = pm.queryIntentActivities(activityIntent, 0);
}

kiran puppala
  • 689
  • 8
  • 17