Progressive Web Apps(PWA’s), are a type of application that is developed using web technologies and can be installed on any device like a traditional application. Creating a simple PWA is very easy as it involves adding two important files to the project which are manifest.json and serviceworker.js. After that, the PWA would be ready to be installed on any Operating System.
Follow Making a simple PWA under 5 minutes tutorial to build a PWA (or) follow the steps given below to create a PWA.
Step 1: Create a manifest.json file in the same directory where index.html file is placed. This file contains the app name, start URL, theme color and some more basic information about the app in JSON format
Step 3: Link serviceworker.js to index.html using <script> tag in index.html.
Finally, you have made a PWA. PWA’s can help you to make your website into an app in your user’s smartphone. Some examples of Google Map Go, Twitter lite, and Instagram Lite. If you look at PWA’s clearly, they are not using traditional APK files for installation. So these PWA can be submitted to the play store, but we can install all the above examples from the play store. This made possible by Google using a technology called Trusted Web Activity(TWA).
Google says “A Trusted Web Activity lets your Android App launch a full-screen Browser Tab without any browser UI. This capability is restricted to websites that you own, and you prove this by setting up Digital Asset Links. Digital Asset Links consist essentially of a file on your website that points to your app and some metadata in your app that points to your website. When you launch a Trusted Web Activity, the browser will check that the Digital Asset Links check out, this is called verification. If verification fails, the browser will fall back to displaying your website as a Custom Tab.“
For this tutorial, we use the website django-blogiee.herokuapp.com. You can look into its manifest.json and serviceworker.js.
There are three ways to do this as follows:
- If you are an Android developer you can build yourself and you have no need to follow this tutorial(Hard way)
- Even you are not an Android developer but have experience with NodeJs, NPM, JDK, and android command-line tools and command-line interface you can use the Bubblewrap project.(Medium way but need a lot of downloads)
- If you are running your blog using pre-built Content Management Systems(CMS) like WordPress, Ghost, and its plugins, You can follow this tutorial. (Easy way)
Make sure your website is a fully compatible PWA. You can use the Google LightHouse tool to look like the below picture.
Now if you are Good with your PWA, go to website PWABuilder by Microsoft and place the URL of your website and click start. if you see your website score as 100, then click build my PWA. you will see something like the below picture.
Then you can download your android package which can be submitted to the play store. Even you can download packages for Apple App Store, Windows Store, and Galaxy store.
Extract the Downloaded Zip to get the APK file to add the Digital Asset file “assetlinks.json”. Make sure your assetlinks.json file can be found at URL https://<your domain>/.well-known/assetlinks.json.