Play Store now accepts progressive web applications (PWA)
  • Transfer
  • Tutorial

Disclaimer: I am not affiliated with Google Play, Chrome or any of the companies mentioned. This is not an official statement. The logo and names are used for illustrative purposes only.

Chrome 72 for Android has the long-awaited Trusted Web Activity feature. This means that we can now distribute PWA through the Google Play catalog and run Chrome without a UI offline for native packages! I played for some time with this function, delving into the API, and here I will tell you what it is about, what to expect and what is available today.

PWA in the Play Store catalog

Chrome 72 for Android is now available for all users, and in this version the Trusted Web Activity (TWA) system is implemented. In short, Chrome is launched offline (without a toolbar and UI) for native Android packages.

To begin with, publishing in the catalog is not as simple as it should be (for example, entering a URL on Google Play, and the application will start). In addition, you cannot use the available WebAPK and publish the application in the directory. It uses the Java API, which interacts with Chrome through services and seems to be at an early stage of development. So you have to do a lot manually.

I see this as the first step. Surely soon there will be a better toolkit (perhaps from the community) with support for all available APIs and a one-click launch. But on the current API, you can publish it in the PWA launcher directory. I will share my experience how this is done.

For some reason, this feature has not yet appeared in the Chrome Platform Status , and the documentation has not yet been updated (it has not been updated at all for more than 15 months).

Update from February 5th . Chromium's blog has posted a short note on TWA support and some of the technical details mentioned in this article.

Update from February 1 . Paul Kinlan, Chrome's lead developer at Google, confirmed the release of the TWA feature and that the documentation is delayed: the reason for the delay is that the permission for the new Chrome 72 feature was taken at the last minute.

Video from Pete Le Page a year ago with TWA explanation

Why publish PWA in a directory?

This is a web platform, Karl! Why use a directory?

Well, this is a long conversation, but for many years I have been consulting a large and small business, and when we look at developing PWA, the application catalog is constantly mentioned: “Our users will search for an application there,” “We already have our own application, and we don’t want to lose users ”,“ We ​​need access to our own API ”or“ I want to monetize PWA ”.

From now on, it became possible to publish PWA in the catalog, as well as work from the browser. Of course, this is a separate operation. Play Store does not emulate Microsoft Store: your PWA will not appear in the store unless you compile the APK and publish it.

Advantages over standard PWA

In addition to the new distribution mechanism and new users from the directory (and even from Google search in the “Applications” section), other advantages appear:

  • Ability to place the widget on the main screen.
  • Application shortcuts (with a long press on the application icon) and other deep integration with the OS.
  • Work with the "partner" on wearable devices or the expansion of Android Auto.
  • Reinstall after a hard reset or backup restore on a new phone.
  • Background services that access their own functions (communication with PWA is still limited - more details below).
  • Monetization (currently limited, more details below).
  • Some native screens mixed with PWA content.
  • Distribute more than one PWA icon in the launcher and / or on the home screen, pointing to different URLs (within the same host).
  • Best support internationalization.

What is innovation?

There were already some PWA in the catalog, but now they are much easier to prepare and publish.

There are already some PWA in the Google Play Store, such as Google Maps Go, Instagram Lite and Twitter Lite. The first application uses some kind of private version of pre-TWA, and the last two - WebView, it was at least not perfect, but the only way to do something like this before the advent of TWA. Applications have a lot of machine code for some things, like notifications. We want to publish PWA as web developers and don’t want to write a lot of Java code.

TWA is a special mode based on custom tabs of Chrome , which from the version of Chrome 45 allow you to launch the browser built into the application.

Is TWA a hybrid framework similar to Cordova?

Not. With Cordova and other hybrid solutions, you usually deliver resources (HTML, JS, CSS, etc.). in the apk package. In addition, there is a different engine, it is isolated from the user's browser, so it does not support session or cache sharing.

This is what PWA looks like with Trusted Web Activity. I do not see the implementation of color schemes yet.

With the help of Trusted Web Activity there is no need to pack resource files (only native components, if they are needed); All resources are downloaded and updated on the fly through a service worker. Your PWA is always rendered with the installed version of Chrome, with its repository, cache, and sessions. Thus, if the user has opened a session on the website, and then installed the application from the Play Store, he will be already authorized in the system.

Play Store Requirements

The URL used for the trusted web operation must meet the following requirements:

  • PWA Criteria transmission (HTTPS, service worker with fetch event handler, web application manifest with 512px icon, background_color and basic set of other properties).
  • A performance rating of at least 80/100 in the Lighthouse (available in the Chrome developer tools or as NPM CLI).
  • All current rules of the Play Store.

According to a Chromium blog post , "applications that do not meet TWA quality requirements or Play Store rules may be denied admission or may be excluded."

I'm not sure yet that the Play Store QA team checks all these requirements when publishing an application.

PWA security model in the Play Store

Your PWA will obey the security model of the browser, not the native application, until you add the native code directly to the APK. Since everything is under the control of the browser, the user should know that even if he has just installed the application, he will have session data, local storage and permissions already set for this host in the browser. That's why when you first start it shows a mini-message "Works in Chrome" :

In addition, when the user deletes the application, you will receive a warningthat the state and data of the application are still available in Chrome, so if necessary, you should clear the cache. Among such traces, for example, Web Push permission: even if the user deletes the application, he will continue to receive push notifications anyway. The message was noticed by Henry Lim: Paul Kinlan from the Chrome team told

about the need for such notifications .

Ways to develop

To create a package with TWA, you first need Android Studio . So far, all the options are experimental and are described only by code examples in the Chrome repository on GitHub.

Application Development Options with TWA:

  • Using the high-level Java Support Library from the Chrome team: in this case, you do not need to write your own Java or Kotlin code. Create an Android Studio project (or clone an example), configure some metadata in AndroidManifest.xml from the web application manifest - and you're done.

    The framework will provide a connection to the TWA and additional features for creating a Settings entry in the Android device, as well as making push notifications available. Now the library is in the temporary Jitpack repository. I think in the future she will move to another place.
  • Manually work with Trusted Web Activity . If you have experience developing Android applications in Java or Kotlin, you can simply manually connect PWA. So you can leave some native actions, opening Trusted Web Activity only at the right moment. In this case, I offer to explore the library of support and understand how to connect to the project from Chrome.

February 5th update : now the Android documentation for TrustedWebUtils , a TWA helper , is available on the Android website .

Manifest distribution

PWA in the App Store will not accept the web application manifest; you must manually copy some values. The icons are taken from the “res” folder, as in any native Android application, the orientation lock should be defined in the AndroidManifest activity record, etc.

When using the support library, the splash screen is created automatically, but other properties of the manifest will not be used. In fact, in my testing, I couldn’t apply a color theme when PWA was opened on the screen.

URL validation

TWA will work only after a digital domain handshake with the application. The mechanism is known as Digital Assets Links . It creates a trust relationship between your host and the APK, proving that you own a PWA and that you will not publish applications that you do not own to the Play Store. It also establishes a digital channel between the site and the native application, which theoretically could allow them to exchange private data (but it seems that this is not possible with today's TWA API).

With Digital Assets Links, you should put a <your-domain> /. Well-known / assetlinks.json file on your domain.. This JSON file contains information about the Android package (for example, the package identifier) ​​and the certificate hash of your application, which you can find out using the command in the console. The Android package will have a duplicate of the host URL. There is an online validator to check that everything is in order.

If you haven’t done a handshake, TWA is not activated, and your application will simply use regular Chrome Custom Tabs with a minimal Chrome interface, as if displaying : minimal-ui in PWA. I'm not quite sure, but probably the Play Store can reject applications that simply point to regular tabs without validating TWA. I don’t know for sure at what point Chrome is checking Digital Asset Link; if every time you access an application, it can be a performance issue. I think caching is possible, and the Play Store can do a check before approving an application during admission to the directory. Let's see what will be written in the documentation.

There is a (not very simple) mechanism for bypassing the Digital Asset Link certification process for development purposes, described below.

Application Publishing

To publish a PWA shortcut using TWA, you must follow all the rules of the Play Store. For more information, see the Developer Policy Center . You will also need to create a publisher account with a one-time fee of $ 25, metadata, screenshots and marketing materials for the application.


When you finish development in Android Studio and you have an account to the developer console, you need to create an APK for production and sign it with a key created in Android Studio. You can use the App Signing by Google Play service to simplify the process in the future.

Google Play console

There are no special rules or processes to download these applications, but Revision may detect that you are using TWA and will verify that: 1) Digital Assets Link is working; 2) The URL passes the PWA criteria (mainly for the fetch event handler in the service worker).

For publication in the Play Store you will have to specify a lot of metadata and graphic resources.

Update application

If you change the content, you do not need to reload the application, unless you change the application completely (in accordance with the rules of the directory). You continue to update it through service workers and updates on the server. New APK will have to download only if you want to change the metadata, native code or icons.


Now the platform has certain limitations, but this is only the beginning. I hope in time they will be removed.

PWA in subfolders

If you publish your PWA in a subfolder of the host, then several problems arise.

  • Digital Asset Link connects the entire domain, not just the folder.
  • The current support library seems to treat the entire host as an Intent (Link Capturing), even if the PWA is in a subfolder.

No internal applications

This is a limitation of the Play Store itself (you cannot publish applications for the local network or applications intended only for you and your company). You can use TWA and create apk that will be deployed outside the store.

Digital Asset Link works only with publicly accessible URLs, because Chrome must verify that we own the domain, and this is not possible with internal URLs.

First boot

When you first open a newly installed application, there are no application files on the device yet (Service Worker is not registered yet if the user has not opened PWA before), so the user will see a blank white screen in offline mode. I think in future versions it would be useful to implement some swap via Chrome after installing the application. If you use the TWA API instead of the support library, then you will find the situation and correctly inform the user through the native API.

Calling native code

There is already a bidirectional link between the TWA server (Chrome) and the TWA client (our APK). This channel is currently used only for sending push notifications and displaying them in a native application, and not in Chrome.

There is a certain potential in the simple combination of native code and JavaScript, giving PWA access to native code, similar to the APPX / PWA mechanism in Microsoft Store.

Perhaps in the future it will be possible to register Java / Kotlin classes in the TWA client so that we can actually call them using the JavaScript API when our PWA is rendered in TWA mode.

Today, the only way to execute native code is to use Intents to open other native actions and then reopen TWA, sending and receiving arguments through URI parameters.

In addition, you can create some kind of web server or WebSocket server in the native code, and send PWA to it, but this is strange, difficult, and it may be unnecessary to waste the battery. But we have a whole new world of possibilities. Let's see what the community comes up with!

Monetization with Play Store

If you have a paid application, you cannot easily verify that the user actually paid for it (after all, the content is just a URL). In addition, if you want to sell some digital resources or subscriptions using the Play Store wallet, then it is difficult to implement such a scheme without an actual bridge with a native code.


I'm not sure if this is a bug or some kind of problem with my IDE, but remote debugging of service workers from TWA does not work. I can check the context of the window, but not the service worker.

Other engines

Now TWA only works on Chrome, but in the future other browsers may clone APIs: for example, Samsung Internet, Edge or Firefox.

February 4th Update : TWA works on the Android Custom Tab protocol, which other browsers are currently implementing. Therefore, if another browser is installed on the system by default, it can open TWA with the contents of PWA. However, additional testing is required to understand how this works.

What happens if the user has an older version of Chrome and he installs the app from the Play Store? In this case, the PWA will appear as a custom Chrome tab, rather than in a completely offline mode.

Google Maps Go in the Play Store has already used something similar to TWA, and Chrome is listed as a requirement for work.

What happens if a user doesn't have Chrome at all? Today, when using the support library, the application will not work at all (if there is no other browser with support for the Custom Tabs protocol). If you use the TWA API in native Java / Kotlin code, you can check the accessibility of the browser and download an alternative solution, such as WebView, or open a browser.

Although Android devices without Chrome are rare, but on some it is not installed by default, including on all new devices in Europe .

Other platforms

PWA does not work on wearable OS (watch), but I'm not quite sure what is happening on other Android platforms. There is probably no support yet, but you need to check it out. I'm talking about Android TV or Chromebooks from the Play Store. If you have not tested these platforms, it makes sense to disable them in the directory list.

WebAPK conflict

If you installed PWA from Chrome, then you already have an APK for this URL, signed by the Play Store, but the catalog will still leave the application on the list and allow the user to install it too. And vice versa: installing an application from the directory will not prevent Chrome from prompting the user to “add” it from the browser. I think this can be avoided if WebAPK also receives Digital Asset Link or we can somehow match the identifier of the WebAPK application, but this is unlikely to happen in the near future. We'll see.

Two Starbucks applications running simultaneously: WebAPK and our own APK

You can block the Chrome offer to install the WebAPK and instead show your application from the directory using the related_applications attribute and the prefer_related_applications attributes of theweb application manifest. Get Installed Related Apps API may in the future help resolve this conflict.

Creating the first PWApk

I know, I just invented the word PWApk, but it sounds good, right?

A few years ago I made a video course on native Android web applications . Although not entirely related to PWA, it does help to understand the Android ecosystem.

The easiest way to make a TWA-based APK is to clone a sample SVGOMG repository from the ChromeLabs repository on GitHub.

You can clone the git repository or launch a new project. In our case, we are starting a new project only to better understand the topic.

Create a new project in Android Studio and select No Activity : we will use only Trusted Web Activity from the support library.

Let's start with an empty project

Fill in the data, select the project name (we will change it later) and the package name: this will be the ID of our application in Android, as well as in the directory. I recommend using the host name in reverse order and an arbitrary name at the end. For example, if you have a host the package can be called com.mypwa.calculator .

API 19 will be suitable as a base (Android 4.4). It seems that soon it will be the minimum version needed for Chrome . Some TWA functions will only work with API 23 (Android 6.0), but the support library will take care of this.

February 5 update : Chrome officially announced that TWA only works with Android 4.4 KitKat. Thus, this function is not available to approximately 5% of active Android users: they will be rolled back to the version with the custom tab and address bar.

Selecting the minimum API level will limit the list of devices for which PWA will be offered in the Play Store catalog

Add dependency

The next step is to add the TWA support library as a dependency, so we ’ll open two files called build.gradle :

Two configuration files: for the project and for the Android application

We start with the project file. Add the following line in the allprojects> repositories section :

maven { url "" }

In the next step, we open the module's build.gradle and add in dependencies:

implementation 'com.github.GoogleChrome:custom-tabs-client:e446d08014'

TWA Setup

The next step is to set the PWA parameters for Trusted Web Activity in the module file; add it to the defaultConfig section :

manifestPlaceholders = [
        hostName: "",
        defaultUrl: "",
        launcherName: "Starbucks",
        assetStatements: '[{ "relation": ["delegate_permission/common.handle_all_urls"], ' +
         '"target": {"namespace": "web", "site": ""}}]'

Here I will use Starbucks PWA as an example. Information from the Digital Asset Link process will be required for the assetStatements key. We will skip this part for now. The property named launcherName must match the short_name in the manifest of the web application.

Manifest customization

Android applications have their own manifest, they will not accept a web application manifest. The desired file is located in the app> manifests section and is called AndroidManifest.xml. There you will find the self-closing Application XML element.

The default Android manifest file

There we change the android: label value to $ {launcherName} , which we set earlier in the metadata, so that we will have the only source of truth for the application name.

The next step is to configure this file, starting with the <application> tag, to add child elements to it, which will look like this:

<meta-dataandroid:name="asset_statements"android:value="${assetStatements}" /><activityandroid:name=""android:label="${launcherName}"><meta-dataandroid:name=""android:value="${defaultUrl}" /><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter><intent-filter><actionandroid:name="android.intent.action.VIEW"/><categoryandroid:name="android.intent.category.DEFAULT" /><categoryandroid:name="android.intent.category.BROWSABLE"/><dataandroid:scheme="https"android:host="${hostName}"/></intent-filter></activity>

The code below will configure the TWA using the support library and the Intent Filter so that the application receives links to PWA and Digital Asset Link. I’ll skip the details of what’s happening in terms of the Android app.

It's time to sync.

At this point, you need to tell Android Studio to accept all your changes by clicking Sync Now . If everything is done correctly, then no errors will pop up.

Replacing Icons

At the moment, the application uses only the Android default icon, so you need to replace all the files in app> res> mipmap in different subfolders for different pixel densities. There are two versions: square and rounded icons. Rounded appeared in Android 7.1, and if you want to ignore them, then delete the link android: roundIcon link in AndroidManifest.xml.

You need to take the icons from the manifest and copy them into mipmap subfolders with corresponding names

Theme setting

Finally, you need to open app / res / values ​​/ styles.xml and make some changes to the theme so that it looks like PWA:


You can change the colors from app / res / values ​​/ colors.xml , but I have not yet seen this work in TWA.

If you limit the orientation in the manifest, you can add this restriction to the <activity> element in AndroidManifest.xml.

Ready for testing?

We are ready to test our PWApk, but before that you need to set up the TWA development mode for Chrome on a test Android device or in an emulator (with Chrome 72+).

Chrome setup

Make sure you have Chrome stable version 72 and open chrome: // flags . Find the option Enable command line on non-rooted devices and check the box . Restart the browser.

Then you need to configure Chrome to bypass Digital Asset Link for the host we want to test, in our example, .

To change the command line options for Chrome for Android, you need to write a text file to the Android file system. The easiest way to do this is through adb (android debug bridge), which should be registered in the path (google, if that), and run the command:

adb shell cat /data/local/tmp/chrome-command-line _ - disable-digital-asset-link-verification-for-url=""

You can use a simple bash script from Google.

You need to stop Chrome, so that when it starts it will accept the new settings

and restart Chrome. But it’s not just to remove the application from the task list, but to force the entire process out of the settings (Force Stop). I had to do it a couple of times before it worked.

Warning that the flag is on and everything went well.

If everything is done, every time you open Chrome, you will see a warning about an unsupported flag. If you launch the application from Android Studio, your PWA will finally start and work offline under the icon and name of your APK.


The ability to publish PWA in the Google Play catalog really changes the rules of the game. It seems that we now have a very early version of the API and definitely need some work. I really want to be able to enter the URL of our PWA and get an APK file from it. This is not very easy due to the Digital Asset Link verification system. Only the Play Store can do this using the same WebAPK that they generate.

I used to wonder if Google approves of the PWA application or leads a war with them . But now they have removed their suspicions, at least in part of the TWA.

Let's hope that TWA in Chrome 72 is the first step in a long journey!

Also popular now: