Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How get list of web browsers in system

Tags:

java

android

How can I get programmatically a list of web-browsers in system?

Update: I know what manifestfile of that applications must have attribute android:scheme="http" or android:scheme="https". I know how get list of all application in system throw getPackageManager().getInstalledPackages( 0);. I don't know how get this attribute?

like image 485
Tapa Save Avatar asked Feb 27 '13 13:02

Tapa Save


People also ask

How many browsers are there in total?

There are four leading web browsers − Explorer, Firefox, Netscape, and Safari, but there are many others browsers available. You might be interested in knowing Complete Browser Statistics. Now we will see these browsers in bit more detail.

What is the most used browser?

As of August 2022, Google's Chrome is the leading internet browser in the world with a global market share of 65.52 percent. In other words, more than six in ten people use Chrome to browse the internet. Apple's Safari is in second place with 18.78 percent, 46.74 percentage points behind.

Which is the fastest browser for Windows 10?

Google Chrome is the fastest web browser you can get on a Windows machine. It surpassed the competition in three out of four tests, outranking even Microsoft's latest Edge browser—which is now based on Chromium—in all but one test.

What are the browsers that we are commonly using?

Common web browsers include Microsoft Edge, Internet Explorer, Google Chrome, Mozilla Firefox, and Apple Safari.


2 Answers

You can check, for example, what Activities in the system can handle a specific Intent, like this:

    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;
            }

Hope this will work for you.

like image 192
Egor Avatar answered Sep 30 '22 11:09

Egor


You can use a package manager along with an intent to open a browser to get the list of all the browsers in the device. To get the package name of the app, you can use it.activityInfo.packageName, where it is a list item.

val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("http://www.aurl.com"))
val browsersList = packageManager.queryIntentActivities(browserIntent, 
                   PackageManager.MATCH_ALL)
browsersList.forEach {
    val packageName = it.activityInfo.packageName
}
like image 44
Devansh Maurya Avatar answered Sep 30 '22 10:09

Devansh Maurya