How to publish PWA app on Google Play Store – Step by step guide

The very first question which my clients ask is, “Will my users be able to download the app from Google Play or Apple App Store?”

Well, traditionally the answer to this question was a no, but things had changed completely when Google updated the Chrome to version 72 which introduced TWA (Trusted Web Activities).


TWA is an entirely new way to integrate the content of your web app with the Android app using a protocol based on Custom Tabs.

I will explain to you the step-by-step process to publish your PWA app on the Google Play Store.

Setting up a Trusted Web Activity (TWA)
To setup TWA you don’t need to write any Java code. You require the Android Studio.

Create a new TWA project in Android Studio
So first, you need to create a new project. Launch Android Studio and click on “Start a new Android Studio project.”

After that, choose the option “Add No Activity,” which will allow us to configure the project.

The configuration is pretty simple, so let’s get started –

Name – Here, you will add the name of the application.

Package name – The package name is an identifier for your Android app on the Google Play Store. The package name must be unique.

Save location – It is just the path where you want your files to exist locally.

Language – You can keep it at default, i.e., Java as the app is already written.

Minimum API level – We are covering this in the next step. Let’s select API 19 for now.

Rest leave the checkboxes unchecked and click on Finish.





Add TWA support library

Add support library to TWA by modifying two files in the project directory Gradle Scripts.


Next, you need to add a Git package manager. It eases the process of publishing our web app. For the sake of this example, we will be using JitPack.


JitPack is very robust and made explicitly for Android apps although it is paid but definitely worth the cost if you are publishing your PWA app on the Play Store for the very first time.

The next step is to connect your project with JitPack. Open the support library build.gradle (Project: VTNetzwelt) and add the following code –



It tells the project to look at JitPack for the app repository.

Now open build.gradle file and add the required dependencies to the project –


As TWA library uses the features of Java 8, so the next step is to enable Java 8 –



Next step is to define the app name, the location where the app is hosted and the default URL –



Setting up Android App Manifest

There is an AndroidManifest.xml file for every Android app which provides all the essential information about the app such as package information, device compatibility, etc. which helps Google Play display app requirements on Play Store.

The first thing that needs to be addressed in this file is Activity. It implements the user interface and is required in TWA.

Open the manifest file and replace the existing package name with your application ID.

Now add the TWA activity by adding <activity> tag inside the <application> tag –


Connecting the PWA and the app

The connection needs to be established on both ends = TWA (application) and PWA (website).

To establish the connection, we need to add assetStatements in our manifestPlaceholders file. It will hold the information about the PWA.

Read More

Comments

Popular posts from this blog

Magento 2.3 – Everything You Need To Know

Google releases source code for I/O app 2018