android-components / mozilla.components.support.utils / Browsers

Browsers

class Browsers (source)

Helpful tools for dealing with other browsers on this device.

// Collect information about all installed browsers:
val browsers = Browsers.all(context)

// Collect information about installed browsers (and apps) that can handle a specific URL:
val browsers = Browsers.forUrl(context, url)`

Types

Name Summary
KnownBrowser enum class KnownBrowser
Enum of known browsers and their package names.

Properties

Name Summary
defaultBrowser val defaultBrowser: <ERROR CLASS>?
The ActivityInfo of the default browser of the user (or null if none could be found).
firefoxBrandedBrowser val firefoxBrandedBrowser: <ERROR CLASS>?
The ActivityInfo of the installed Firefox browser (or null if none could be found).
hasFirefoxBrandedBrowserInstalled val hasFirefoxBrandedBrowserInstalled: Boolean
Is there a Firefox browser installed on this device?
hasMultipleThirdPartyBrowsers val hasMultipleThirdPartyBrowsers: Boolean
Does this device have multiple third-party browser installed?
hasThirdPartyDefaultBrowser val hasThirdPartyDefaultBrowser: Boolean
Does this device have a default browser that is not Firefox (release) or this app calling the method.
installedBrowsers val installedBrowsers: List<<ERROR CLASS>>
List of ActivityInfo of all known installed browsers.
isDefaultBrowser val isDefaultBrowser: Boolean
Is this application the default browser?
isFirefoxDefaultBrowser val isFirefoxDefaultBrowser: Boolean
Is Firefox (Release, Beta, Nightly) the default browser of the user?

Functions

Name Summary
isInstalled fun isInstalled(browser: KnownBrowser): Boolean
Does this device have browser installed?

Companion Object Functions

Name Summary
all fun all(context: <ERROR CLASS>): Browsers
Collect information about all installed browsers and return a Browsers object containing that data.
forUrl fun forUrl(context: <ERROR CLASS>, url: String): Browsers
Collect information about all installed browsers that can handle the specified URL and return a Browsers object containing that data.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.