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?
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.
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.
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.
Common web browsers include Microsoft Edge, Internet Explorer, Google Chrome, Mozilla Firefox, and Apple Safari.
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.
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With