MCPcopy Index your code
hub / github.com/GoogleChrome/android-browser-helper

github.com/GoogleChrome/android-browser-helper @android-browser-helper-2.7.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release android-browser-helper-2.7.2 ↗ · + Follow
936 symbols 2,988 edges 134 files 271 documented · 29%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Android Browser Helper

CI Status Badge

The Android Browser Helper library helps developers use Custom Tabs and Trusted Web Activities on top of the AndroidX browser support library. It contains default implementations of many of the common tasks a developer will find themselves requiring, for example:

  • Creating a Launcher Activity that simply launches a Trusted Web Activity.
  • Code for choosing an appropriate Custom Tabs provider.
  • Creating an Activity to launch the browser's site settings for a TWA.

Adding Android Browser Helper to an Android project

Android Browser helper is available on the Google Maven. To use it, modify your application's build.gradle and add the library as a dependency, as described below:

dependencies {
    //...
    implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.7.2'
}

Information for Google Play's data disclosure requirements

The Android Browser Helper library is intended to allow Android applications to interact with browsers on the device. As such, it will share certain types of information with the browser.

Data types collected / shared

Web browsing: URLs handled by the application are shared with the browser when a Custom Tab or a Trusted Web Activity are launched.

URLs are also shared with the browser by certain features like mayLaunchUrl(), so that the browser can speed up loading performance of those pages.

When the WebView fallback feature is enabled by the developer, the application may store the navigation history and browser storage, like cookies on the device.

User location (Optional): The SDK may share location data with the host browser, when the location delegation library is used. Users can control sharing of the location using the Android permission dialogs and the System settings.

Purchase History (Optional): The SDK may share purchase history data with the host browser when the Google Play billing library is used. Only purchases made within the application are shared.

This SDK does not transfer any information over the network. Web browsing information may be stored if the WebView fallback is enabled. The permission to read the location can be managed via the usual Android settings.

Source Code Headers

Every file containing source code must include copyright and license information. This includes any JS/CSS files that you might be serving out to browsers. (This is to help well-intentioned people avoid accidental copying that doesn't comply with the license.)

Apache header:

Copyright 2019 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Extension points exported contracts — how you extend this code

BillingWrapper (Interface)
Wraps communication with Play Billing to provide a simpler interface and allowing mocking in tests. [6 implementers]
playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/BillingWrapper.java
ExtraCommandHandler (Interface)
An interface for handling extraCommand in androidx.browser.trusted.TrustedWebActivityService. [6 implementers]
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/ExtraCommandHandler.java
ServiceConnectionCallback (Interface)
Callback for events when connecting and disconnecting from Custom Tabs Service. [3 implementers]
demos/custom-tabs-example-app/src/main/java/org/chromium/customtabsdemos/ServiceConnectionCallback.java
TrustedWebActivityLocationCallback (Interface)
A wrapper for androidx.browser.trusted.TrustedWebActivityCallbackRemote that we can construct and use for testin
locationdelegation/src/main/java/com/google/androidbrowserhelper/locationdelegation/TrustedWebActivityLocationCallback.java
UserCallback (Interface)
(no doc)
demos/custom-tabs-oauth/src/main/java/com/google/androidbrowserhelper/demos/customtabsoauth/GithubApi.java
UserCallback (Interface)
(no doc)
demos/custom-tabs-auth-tab/src/main/java/com/google/androidbrowserhelper/demos/customtabsauthtab/GithubApi.java
DigitalGoodsCallback (Interface)
A wrapper for androidx.browser.trusted.TrustedWebActivityCallbackRemote that we can construct and use for testin
playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/digitalgoods/DigitalGoodsCallback.java
FallbackStrategy (Interface)
(no doc) [5 implementers]
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/TwaLauncher.java

Core symbols most depended-on inside this repo

Shape

Method 780
Class 138
Interface 18

Languages

Java100%
Kotlin1%

Modules by API surface

playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/MockBillingWrapper.java32 symbols
playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/provider/PaymentResult.java22 symbols
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/TwaLauncher.java22 symbols
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/LauncherActivity.java22 symbols
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/ManageDataLauncherActivity.java21 symbols
androidbrowserhelper/src/androidTest/java/com/google/androidbrowserhelper/trusted/TwaLauncherTest.java21 symbols
androidbrowserhelper/src/test/java/com/google/androidbrowserhelper/trusted/ManageDataLauncherActivityTest.java18 symbols
androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/WebViewFallbackActivity.java17 symbols
playbilling/src/main/java/com/google/androidbrowserhelper/playbilling/digitalgoods/Logging.java16 symbols
androidbrowserhelper/src/test/java/com/google/androidbrowserhelper/trusted/TwaProviderPickerTest.java16 symbols
playbilling/src/androidTest/java/com/google/androidbrowserhelper/playbilling/provider/PaymentActivityTest.java15 symbols
androidbrowserhelper/src/androidTest/java/com/google/androidbrowserhelper/trusted/testcomponents/TestCustomTabsService.java15 symbols

For agents

$ claude mcp add android-browser-helper \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page