Google is committed to advancing racial equity for Black communities. See how.

Browser

Display webpages in the user's default browser.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
October 28, 2020 1.2.0 - 1.3.0-beta06 -

Declaring dependencies

To add a dependency on Browser, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    implementation "androidx.browser:browser:1.2.0"
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.3.0

Version 1.3.0-beta01

October 28, 2020

androidx.browser:browser:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits.

API Changes

  • Renamed bindCustomTabServicePreservePriority to bindCustomTabsServicePreservePriority (I29ac1)

Bug Fixes

  • API lint check for MissingGetterMatchingBuilder is enabled for androidx (I4bbea, b/138602561)

Version 1.3.0-alpha06

October 1, 2020

androidx.browser:browser:1.3.0-alpha06 is released. Version 1.3.0-alpha06 contains these commits.

New Features

  • Adds CustomTabsIntent#setShareState which allows the developer to set share state to either enabled, disabled or leave it up to the browser. (I153fe)
  • Adds CustomTabsIntent.Builder#setDefaultColorSchemeParams which should be used in place of the now deprecated #setNavigationBarColor, #setNavigationBarDividerColor, #setToolbarColor, #setSecondaryToolbarColor methods.(I09012)

API Changes

  • API lint check for the StaticFinalBuilder is enabled for androidx (I2b11b, b/138602561)
  • Adds CustomTabsService#KEY_SUCCESS and TrustedWebActivityService#KEY_SUCCESS that can be used for indicating extraCommand is success. (I6f7b5)

Version 1.3.0-alpha05

August 5, 2020

androidx.browser:browser:1.3.0-alpha05 is released. Version 1.3.0-alpha05 contains these commits.

New Features

  • Allow setting the orientation of launched Trusted Web Activities.
  • Allow setting the navigation bar divider color for Trusted Web Activities and Custom Tabs.

API Changes

  • Added a setScreenOrientation method in TrustedWebActivityIntentBuilder.
  • Added an @IntDef for ScreenOrientation.LockType to represent a lock type (I802d2)
  • Added the setNavigationBarDividerColor method to TrustedWebActivityIntentBuilder and CustomTabColorSchemeParams. (Ia04dd)
    • Added @IntDefs to TrustedWebActivityIntentBuildermethods that take a color scheme.

Version 1.3.0-alpha04

June 24, 2020

androidx.browser:browser:1.3.0-alpha04 is released. Version 1.3.0-alpha04 contains these commits.

New Features

  • Added the CustomTabsClient#bindCustomTabServicePreservePriority method, allowing connecting to a Custom Tabs Service without using the Context.BIND_WAIVE_PRIORITY flag.

Version 1.3.0-alpha03

June 10, 2020

androidx.browser:browser:1.3.0-alpha03 is released. Version 1.3.0-alpha03 contains these commits.

New Features

  • Added TrustedWebActivityCallback interface that can be used by a Trusted Web Activity client to return data to the browser. (I64dbb)

API Changes

  • TrustedWebActivityServiceConnection.extraCommand now also takes a @Nullable TrustedWebActivityCallback parameter. The bundle parameter is now marked as @NonNull instead of @Nullable. (I64dbb)
  • TrustedWebActivityServiceConnection.extraCommand method has been renamed to sendExtraCommand (Id29a8)
  • CustomTabsIntent.Builder#addDefaultShareMenuItem() has been deprecated in favor of the new #setDefaultShareMenuItemEnabled(boolean) and CustomTabsIntent.Builder#enableUrlBarHiding() has been deprecated in favor of the new #setUrlBarHidingEnabled(boolean). (Iad702)

Version 1.3.0-alpha01

January 8, 2020

androidx.browser:browser:1.3.0-alpha01 is released. Version 1.3.0-alpha01 contains these commits.

New features

  • Free form commands can be passed from a browser to a Trusted Web Activity client by calling TrustedWebActivityServiceConnection#extraCommand. The client can handle these in TrustedWebActivityService#onExtraCommand.

API changes

  • The URL provided to CustomTabsSession#mayLauncherUrl and received in CustomTabsService#mayLaunchUrl has been made @Nullable.

Version 1.2.0

Version 1.2.0

December 18, 2019

androidx.browser:browser:1.2.0 is released with no changes since 1.2.0-rc01. Version 1.2.0 contains these commits.

Major changes since 1.0.0

  • Trusted Web Activities
    • Support for Trusted Web Activities is now stable.
    • The TrustedWebActivityIntentBuilder can be used to customize and create a TrustedWebActivityIntent, to launch a Trusted Web Activity.
    • The TrustedWebActivityService can be included or extended to allow clients to display web push notifications handed to them by the browser.
    • The TrustedWebActivityServiceConnectionPool can be used by browsers to connect to the TrustedWebActivityServices in clients. A TrustedWebActivityServiceConnection represents such a connection.
    • Trusted Web Activities can be launched providing information to a Web Share Target.
  • Dark Theme
    • Developers can provide (through CustomTabColorSchemeParams) different theme colors to be used when the device is in light or dark mode.
    • Developers can request that the browser itself is in light or dark mode.
  • Session resumption
    • CustomTabsSessions can be created with an id, allowing subsequent Custom Tabs launches from the same client and id to be merged.
  • The navigation bar colour can be specified for Custom Tabs.
  • Browser Actions related classes are marked deprecated due to incredibly low feature usage and will be removed in a future version of the library.

Version 1.2.0-rc01

December 4, 2019

androidx.browser:browser:1.2.0-rc01 is released. Version 1.2.0-rc01 contains these commits.

Bug fixes

  • Javadoc formatting for code samples was fixed.

Version 1.2.0-beta01

November 20, 2019

androidx.browser:browser:1.2.0-beta01 is released with no changes since 1.2.0-alpha09. Version 1.2.0-beta01 contains these commits.

Version 1.2.0-alpha09

October 23, 2019

androidx.browser:browser:1.2.0-alpha09 is released. Version 1.2.0-alpha09 contains these commits.

New features

  • The Token class can be used to represent the identity of a package, it contains both the package name and the signature of the package’s signing certificate.
    • It is designed to be serialized to a byte[] for persistence.
    • It is used by the TrustedWebActivityService to determine what TWA provider is allowed to connect to it.
    • It is used by the TrustedWebActivityConnectionPool by the TWA provider to determine which packages are valid to connect to.
  • The TokenStore interface is now used by the TrustedWebActivityService to determine which app is allowed to connect to it.
    • It is up to the client to call TokenStore#store, TrustedWebActivityService only loads the Tokens.
  • The TrustedWebActivityServiceConnectionPool (previously TrustedWebActivityServiceConnectionManager) no longer stores the set of verified packages:
    • registerClient and getVerifiedPackages have now been removed.
    • The collection of verified packages is now provided manually to execute (previously connect) and serviceExistsForScope.
  • The TrustedWebActivityService delegates to the overriding class to store the verified provider.
    • setVerifiedProvider has been removed.
    • The client must implement getTokenStore which returns a TokenStore that can be used to store and retrieve a Token.

API changes

  • The TrustedWebActivityServiceConnectionManager class:
    • Is now called TrustedWebActivityServiceConnectionPool.
    • Is now final.
    • Is constructed by the static create method instead of a public constructor.
  • The TrustedWebActivityService class:
    • Has thread annotations on overridable methods.
  • The TrustedWebActivityServiceWrapper class:
    • Is now called TrustedWebActivityServiceConnection.
    • Is now final.
    • Now throws raw RemoteExceptions instead of wrapping them in RuntimeExceptions.
  • The ShareTarget#FileFormField class is now final.
  • The TrustedWebUtils#splashScreensAreSupported method has been renamed to areSplashScreensSupported.
  • The TrustedWebActivityIntentBuilder#getUrl method has been renamed to TrustedWebActivityIntentBuilder#getUri.
  • The SplashScreenParamKey static fields have been prefixed with KEY_.

Version 1.2.0-alpha08

September 18, 2019

androidx.browser:browser:1.2.0-alpha08 is released. Version 1.2.0-alpha08 contains these commits.

New features

  • Introduced new Share Target APIs for Trusted Web Activities. Apps that use Trusted Web Activities can now send data to their Web Share Target, defined by the protocol https://wicg.github.io/web-share-target/level-2/ (aosp/I47b93, aosp/I0ec3e)

API changes

  • Added the callback extraCallbackWithResult to ICustomTabsCallback (aosp/Ic2cc2)
  • Marked some CustomTabsSession method parameters as Nullable or NonNull (aosp/Iec460)
  • TrustedWebActivityIntentBuilder now builds a TrustedWebActivityIntent instead of a raw intent (aosp/I03fb6)

Bug fixes

  • CustomTabsClient now uses the legacy requestPostMessageChannel if needed (aosp/Ibb324)
  • Fixed CustomTabsSessionToken#equals (aosp/I7f249)
  • CustomTabsClient now uses the legacy newSession if possible (aosp/Ie27dc)

External contribution

Version 1.2.0-alpha07

August 7, 2019

androidx.browser:browser:1.2.0-alpha07 is released. The commits included in this version can be found here.

New features

  • Dark Theme

    • Developers can provide theme colors to be used when the device is in dark mode.
    • Developers can also override whether the launched browser should be in dark or light mode.
    • The navigation bar color can be specified for Custom Tabs.
  • Trusted Web Activities

    • The TrustedWebActivityBuilder can be used to easily create and launch Trusted Web Activities.
    • The TrustedWebActivityService and related classes can be used to communicate with the provider - accepting web push notifications for the linked website and displaying them from the client app. This part of the API is liable to change.
  • Custom Tab Session Ids

    • Custom Tabs sessions can now be created with ids, allowing the merging of two sessions launched by the same application with the same id.

API changes

  • Browser Actions related classes and methods have been marked deprecated. Unfortunately, while we had high hopes for the feature, barely anyone ended up using it and only one browser ended up providing support for it. We’re deprecating it to keep the code and the API simple.

Version 1.0.0

Version 1.0.0

September 21, 2018

browser-1.0.0 is released.