Class BrowserSelector

    • Method Detail

      • getAllBrowsers

        @NonNull
        public static List<BrowserDescriptorgetAllBrowsers​(Context context)
        Retrieves the full list of browsers installed on the device.

        Two entries will exist for each browser that supports custom tabs, with the BrowserDescriptor.useCustomTab flag set to true in one and false in the other. The list is in the order returned by the package manager, so indirectly reflects the user’s preferences (i.e. their default browser, if set, should be the first entry in the list).

      • select

        @Nullable
        public static BrowserDescriptor select​(Context context,
                                               BrowserMatcher browserMatcher)
        Searches through all browsers for the best match based on the supplied browser matcher.

        Custom tab supporting browsers are preferred, if the matcher permits them, and browsers are evaluated in the order returned by the package manager, which should indirectly match the user’s preferences.

        Parameters:
        context - Context to use for accessing PackageManager.
        Returns:
        The package name recommended to use for connecting to custom tabs related components.