How to list all Browsers installed on Android?

Asked

Viewed 51 times

1

How do I list/check all browsers installed on an Android device via Java?

1 answer

2


It is impossible to know/determine which applications are of the Browser type, for the simple reason that there is no identifier informing this for Android. It is also very risky for you to search all the Packages you own browser for example.

A suggestion is that, you can list, for example, which Activity'can’t open a certain Intent with a URL:

PackageManager packageManager = context.getPackageManager();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.google.com"));
List<ResolveInfo> list = packageManager.queryIntentActivities(intent,
        PackageManager.MATCH_DEFAULT_ONLY);
        for (ResolveInfo info : list) {
            String name = info.name;
        }
  • Good idea @sicachester! But one question, what is the type of context?

  • Your Activity is already a Context, see here http://developer.android.com/reference/android/app/Activity.html. In this case, within its Activity, only use getPackageManager(), without context

Browser other questions tagged

You are not signed in. Login or sign up in order to post.