Releasing Multiple PWAs to GooglePlay By Using a Single GitHub Page Root
- By : Mydatahack
- Category : Front-End, Web Technologies
- Tags: Android App, Github Page, GooglePlay, PWA
PWA is pretty exciting. As long as you have a static web hosting service, you can create a mobile app with a web site.
I’ve written a few posts about packaging and releasing an Android app to GooglePlay in the past.
– Tips on Creating Android App from PWA
– Why Address Bar Is Not Hidden – Android App with TWA
The first app I created was hosted on a GitHub page. Then, I created a second app and wanted to host from the same GitHub page root url with different starting url. It turned out that this was super easy to do. I am pretty sure there are many people out there trying to do the same thing as me. So, if you are interested in publishing multiple apps from a single github.io root url, this is how it works.
(1) Create Folders and set different start URL
First step is to create folders and set different start URLs for each app.
- root - app1 - index.html ... - app2 - index.html ...
(2) Set different start URL and keep root URL the same in AndroidManifest.xml
When you package apps with Android Studio, you can set two different starting url. But, you can still use the same url for the root.
In AndroidManifest.xml, you can set the url opened by the TWA with the folder name appended to the root url.
android:name="android.support.customtabs.trusted.DEFAULT_URL" android:value="https://mygithubusername.github.io/app1/"
The second app can have a different url to open.
android:name="android.support.customtabs.trusted.DEFAULT_URL" android:value="https://mygithubusername.github.io/app2/"
In strings.xml, we can use the same value for asset statements with different app names.
(3) Add two apps in the same assetlinks.json file
You have .well-known/assetlinks.json in the root. The file takes an array of json object. You can keep appending the apps with their own package names and sha256 cert fingerprints as below. For further information about sharing credentials with apps and sites, you can checkout Google documentation here.
Now, we have multiple apps published from a single github.io page. As you can host static sites for free in github.io, this costs nothing.
Here are the two apps I published from a single github.io url by using this trick.
– Sitecore 9 Certification Exam Prep
– My To Do
Awesome!