Browser

Display webpages in the user's default browser.
Latest Update Stable Release Release Candidate Beta Release Alpha Release
March 6, 2024 1.8.0 - - -

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:

Groovy

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

Kotlin

dependencies {
    implementation("androidx.browser:browser:1.8.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.8

Version 1.8.0

March 6, 2024

androidx.browser:browser:1.8.0 is released. Version 1.8.0 contains these commits.

Important changes since 1.7.0

  • Added CustomTabsIntent.Builder#setInitialActivityWidthPx which allows developers to specify the initial launch width of a Custom Tab. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetPosition which allows developers to specify the Custom Tab’s position when acting as a side sheet. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetDecorationType which allows developers to specify the Custom Tab’s decoration type when it is acting as a side sheet. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetRoundedCornersPosition which allows developers to specify the position of the rounded corners when the Custom Tab is acting as a side sheet. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetMaximizationEnabled which allows developers to enable or disable the maximization button when the Custom Tab is acting as a side sheet. (Ie3564)
  • Added onActivityLayout callback method to interface CustomTabsCallback to let developers know the coordinates of the area occupied by the Custom Tab and the state in which it is being displayed. This will be called when the Custom Tab is first displayed on the screen and each time the occupied area changes. (I443f6)
  • Added onWarmupCompleted callback method to interface CustomTabsCallback to let developers know when CustomTabsClient#warmupfinishes warming up the browser process. (I107cf)
  • Added the session id to extras in CustomTabsSession#setEngagementSignalsCallback and CustomTabsSession#isEngagementSignalsApiAvailable. (Iba7f1)
  • Added experimental support for Minimized Custom Tabs APIs. (I67f2d)

Version 1.8.0-rc01

February 21, 2024

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

Version 1.8.0-beta02

February 7, 2024

androidx.browser:browser:1.8.0-beta02 is released. Version 1.8.0-beta02 contains these commits.

API Changes

  • Renamed CustomTabsIntent.Builder#setActivitySideSheetEnableMaximization to CustomTabsIntent Builder#setActivitySideSheetMaximizationEnabled and made it a public API. It allows developers to enable or disable the maximization button when the Custom Tab is acting as a side sheet. (Ie3564)

Version 1.8.0-beta01

November 29, 2023

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

New Features

  • Add experimental support for Minimized Custom Tabs APIs. (I67f2d)

Version 1.8.0-alpha01

November 15, 2023

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

New Features

  • Added CustomTabsIntent.Builder#setInitialActivityWidthPx which allows developers to specify the initial launch width of a Custom Tab. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetBreakpointDp which allows developers to specify the minimum Custom Tabs window width in order for it to act as a side sheet. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetPosition which allows developers to specify the Custom Tab’s position when acting as a side sheet. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetEnableMaximization which allows developers to enable or disable the maximization button when the Custom Tab is acting as a side sheet. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetDecorationType which allows developers to specify the Custom Tab’s decoration type when it is acting as a side sheet. (I443f6)
  • Added CustomTabsIntent.Builder#setActivitySideSheetRoundedCornersPosition which allows developers to specify the position of the rounded corners when the Custom Tab is acting as a side sheet. (I443f6)
  • Added onActivityLayout callback method to interface CustomTabsCallback to let developers know the coordinates of the area occupied by the Custom Tab and the state in which it is being displayed. This will be called when the Custom Tab is first displayed on the screen and each time the occupied area changes. (I443f6)
  • Added onWarmupCompleted callback method to interface CustomTabsCallback to let developers know when CustomTabsClient#warmupfinishes warming up the browser process. (I107cf)

Bug Fixes

  • ​​Added the session id to extras in CustomTabsSession#setEngagementSignalsCallback and CustomTabsSession#isEngagementSignalsApiAvailable. (Iba7f1)

Version 1.7

Version 1.7.0

November 15, 2023

androidx.browser:browser:1.7.0 is released. Version 1.7.0 contains these commits.

Important changes since 1.6.0

  • Added CustomTabsIntent.Builder#setBookmarksButtonEnabled that enables the bookmarks button in the overflow menu. (Ia792e)
  • Added CustomTabsIntent.Builder#setDownloadButtonEnabled that enables the download button in the overflow menu. (Ia792e)
  • Added CustomTabsIntent.Builder#setSendToExtraDefaultHandlerEnabled that enables sending initial urls to external handler apps. (Ia792e)
  • Added CustomTabsIntent.Builder#setTranslateLanguage that specifies the target language that the Translate UI should be triggered with. (Ia792e)
  • Added CustomTabsIntent.Builder#setBackgroundInteractionEnabled that enables interactions with the background app when a partial Custom Tab is launched. (Ia792e)
  • Added CustomTabsIntent.Builder#setShareIdentityEnabled that allows Custom Tabs to obtain the caller's identity. (I7bf2b)
  • Added CustomTabsIntent.Builder#setSecondaryToolbarSwipeUpGesture that sets a PendingIntent to be sent when the user swipes up from the bottom toolbar. (Id42a2)

Version 1.7.0-rc01

November 1, 2023

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

  • No changes since alpha-01

Version 1.7.0-beta01

October 18, 2023

androidx.browser:browser:1.7.0-beta01 is released with no changes. Version 1.7.0-beta01 contains these commits.

Version 1.7.0-alpha01

October 4, 2023

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

New Features

  • Added CustomTabsIntent.Builder#setBookmarksButtonEnabled that enables the bookmarks button in the overflow menu. (Ia792e)
  • Added CustomTabsIntent.Builder#setDownloadButtonEnabled that enables the download button in the overflow menu. (Ia792e)
  • Added CustomTabsIntent.Builder#setSendToExtraDefaultHandlerEnabled that enables sending initial urls to external handler apps. (Ia792e)
  • Added CustomTabsIntent.Builder#setTranslateLanguage that specifies the target language that the Translate UI should be triggered with. (Ia792e)
  • Added CustomTabsIntent.Builder#setBackgroundInteractionEnabled that enables interactions with the background app when a partial Custom Tab is launched. (Ia792e)
  • Added CustomTabsIntent.Builder#setShareIdentityEnabled that allows Custom Tabs to obtain the caller's identity. (I7bf2b)
  • Added CustomTabsIntent.Builder#setSecondaryToolbarSwipeUpGesture that sets a PendingIntent to be sent when the user swipes up from the bottom toolbar. (Id42a2)

Version 1.6

Version 1.6.0

August 9, 2023

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

Version 1.6.0-rc01

July 26, 2023

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

Version 1.6.0-beta01

June 21, 2023

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

Version 1.6.0-alpha02

June 7, 2023

androidx.browser:browser:1.6.0-alpha02 is released. Version 1.6.0-alpha02 contains these commits.

API Changes

  • Removed CustomTabsSession#getGreatestScrollPercentage. (I6c5ba)
  • Added a new requestPostMessageChannel API which allows specifying the target origin. This means that users can be certain their messages are delivered only to the website they expect. (Id5b7f)

Bug Fixes

  • Updated EngagementSignalsCallback documentation. (Ie833c)

Version 1.6.0-alpha01

May 3, 2023

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

New Features

  • Added Engagement Signals API, which allows developers to receive callbacks for user interactions on the web page such as scrolls. (I835e6)

API Changes

  • Updated Engagement Signals API to simplify the API surface on the Custom Tabs implementation side. (Iaa6dc)

Version 1.5

Version 1.5.0

February 8, 2023

androidx.browser:browser:1.5.0 is released. Version 1.5.0 contains these commits.

Important changes since 1.4.0

  • Added CustomTabsIntent.Builder#setInitialActivityHeightPx, which allows developers to specify the initial launch height of a Custom Tab, and optionally the resize behavior (fixed or resizable). (I48bd3)
  • Added CustomTabsIntent.Builder#setToolbarCornerRadiusDp which allows developers to specify the toolbar's top corner radius. (I48bd3)
  • Added CustomTabsIntent.Builder#setCloseButtonPosition which allows developers to set the position of the close button on the toolbar. (I48bd3)
  • Added an onActivityResized callback method to interface CustomTabsCallback to let developers know when a Custom Tab is resized. (Ic864e)
  • Make parts of CustomTabsCallback APIs asynchronous. (Ic86df)
  • Populates the current app's language in Accept-Language by default to align to Android’s per-app language experience. (I3d1d7)
  • Added @RequiresPermission to APIs that require granting the POST_NOTIFICATIONS permission on SDK 33 and above. This was developed in an internal branch. b/238790278 for reference.

Version 1.5.0-rc01

January 25, 2023

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

  • No changes since 1.5.0-beta01.

Version 1.5.0-beta01

January 11, 2023

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

  • No changes since 1.5.0-alpha02

Version 1.5.0-alpha02

December 7, 2022

androidx.browser:browser:1.5.0-alpha02 is released. Version 1.5.0-alpha02 contains these commits.

API Changes

  • Changed the CustomTabsCallback#onActivityResized behavior and added new parameters to it.
  • Renamed EXTRA_ACTIVITY_RESIZE_BEHAVIOR to EXTRA_ACTIVITY_RESIZE_HEIGHT_BEHAVIOR to better reflect that it is height specific. (Ic864e)
  • Make parts of CustomTabsCallback APIs asynchronous. (Ic86df)

Version 1.5.0-alpha01

October 24, 2022

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

New Features

  • Added CustomTabsIntent.Builder#setInitialActivityHeightPx, which allows developers to specify the initial launch height of a Custom Tab, and optionally the resize behavior (fixed or resizable). (I48bd3)
  • Added CustomTabsIntent.Builder#setToolbarCornerRadiusDp which allows developers to specify the toolbar's top corner radius. (I48bd3)
  • Added CustomTabsIntent.Builder#setCloseButtonPosition which allows developers to set the position of the close button on the toolbar. (I48bd3)
  • Added an onActivityResized callback method to interface CustomTabsCallback to let developers know when a Custom Tab is resized (expanded to full height or minimized back down to initial launch height). (Id99ce)
  • Populates the current app's language in Accept-Language by default to align to Android’s per-app language experience. (I3d1d7)

API Changes

  • Added @RequiresPermission to APIs that require granting the POST_NOTIFICATIONS permission on SDK 33 and above. This was developed in an internal branch. b/238790278 for reference.

Version 1.4.0

Version 1.4.0

November 3, 2021

androidx.browser:browser:1.4.0 is released. Version 1.4.0 contains these commits.

Important changes since 1.3.0

  • Mark PendingIntents as PendingIntent.FLAG_IMMUTABLE for Android 12 compatibility.

Version 1.4.0-rc01

October 13, 2021

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

Version 1.4.0-beta01

September 29, 2021

androidx.browser:browser:1.4.0-beta01 is released with no change since 1.4.0-alpha01. Version 1.4.0-beta01 contains these commits.

Version 1.4.0-alpha01

September 15, 2021

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

Bug Fixes

  • Mark PendingIntents as PendingIntent.FLAG_IMMUTABLE for Android 12 compatibility.

Version 1.3.0

Version 1.3.0

December 2, 2020

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

Major features since 1.2.0

  • Free form commands can be passed from a browser to a Trusted Web Activity client by calling TrustedWebActivityServiceConnection#sendExtraCommand. The client can handle these in TrustedWebActivityService#onExtraCommand
  • Added TrustedWebActivityCallback interface that can be used by a Trusted Web Activity client to return data to the browser.
  • Added CustomTabsIntent#setShareState, which allows developers to specify whether to show a share option or not (or leave it up to the browser).
  • Developers can now set a default screen orientation with setScreenOrientation method in TrustedWebActivityIntentBuilder
  • setNavigationBarDividerColor method is added to CustomTabColorSchemeParams to support changing the color of the navigation bar divider.
  • Added CustomTabsIntent.Builder#setDefaultColorSchemeParams to replace the now deprecated #setNavigationBarColor, #setNavigationBarDividerColor, #setToolbarColor and #setSecondaryToolbarColor methods
  • Added the CustomTabsClient#bindCustomTabsServicePreservePriority method, allowing connecting to a Custom Tabs Service without using the Context.BIND_WAIVE_PRIORITY flag.

Version 1.3.0-rc01

November 11, 2020

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

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.