Overview Stay organized with collections Save and categorize content based on your preferences.
Trusted Web Activity is a new way to openyour web-app contentsuch asyour Progressive Web App (PWA) fromyour Android app using a protocol based on CustomTabs.
Note: Trusted Web Activity is available inChrome on Android, version 72 and above.Looking for the code?
- android-browser-helper library on GitHub
- Trusted Web Activity demos
- Bubblewrap, a NodeJs library / CLI to generate and build Trusted Web Activity projects
There are a few things that make Trusted Web Activity different from otherways to open web content from your Android app:
- Content in a Trusted Web activity istrusted -- the app and the site itopens are expected to come from the same developer. (This is verified usingDigital Asset Links.)
- The content rendered in a Trusted Web Activity comes from theweb: they'rerendered by the user's browser, in exactly the same way as a user would seeit in their browser except they are run fullscreen. Web content should beaccessible and useful in the browser first.
- Browsers are also updated independent of Android and your app -- Chrome, forexample, is available back to Android Jelly Bean. That saves on APK size andensures you can use a modern web runtime. (Note that since Lollipop, WebViewhas also been updated independent of Android, but there are asignificant number ofpre-Lollipop Android users.)
- The host app doesn't have direct access to web content in a Trusted WebActivity or any other kind of web state, like cookies and
localStorage
.Nevertheless, you can coordinate with the web content by passing data to andfrom the page in URLs (e.g. through query parameters andintent URIs.) - Transitions between web and native content are betweenactivities. Eachactivity (i.e. screen) of your app is either completely provided by the web,or by an Android activity
To make it easier to test, there are currently no qualifications for contentopened in the preview of Trusted Web activities. You can expect, however, thatTrusted Web activities will need to meet the sameAdd to Home Screenrequirements. You can audit your site for these requirements using theLighthouse "user can be prompted to Add to Homescreen" audit.
Today, if the user's version of Chrome doesn't support Trusted Web activities,Chrome will fall back to a simple toolbar using a Custom Tab. Itis also possible for other browsers to implement the same protocol that TrustedWeb activities use. While the host app has the final say on what browser getsopened, we recommend the same policy as for Custom Tabs: use the user's defaultbrowser, so long as that browser provides the required capabilities.
Where to go next
If you are looking for quickly building an Android app that just starts and opens your PWA,checkout out theQuick Start Guide.
If integrating Trusted Web Activity into an existing Android App, theIntegration Guideis a good place to get started.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-02-04 UTC.