Read More

How to build PWA APK?

TWA (Trusted Web Activities):

Trusted Web Activities are a new way to integrate your web-app content such as your PWA with your Android app using a protocol based on Custom Tabs. A Trusted Web Activity runs a Chrome browser full screen in an Android app, meaning there is no browser UI visible in the app, including the URL bar.

Digital Asset Links :

TWA uses Digital Asset Links to certify ownership. The Digital Asset Links protocol and API enable an app or website to make public, verifiable statements about other apps or websites. For example, a website can declare that it is associated with a specific Android app, or it can declare that it wants to share user credentials with another website.

Steps to build PWA apk:

1. Add the Jetpack configuration in Project levelbuild.gradle. Under the allprojects section:

2. Add Java 8 features Module level build.gradle. Under the compileOptionssection:

3. Add the TWA Support Library to the project. Under the dependencies section:

4. Add TWA LauncherActivity to the AndroidManifest.xml.

5. Add  Digital AssetLinks statement to remove the URL bar.

We can generate assets links file from URL https://developers.google.com/digital-asset-links/tools/generator. If you will not configure Digital Asset Links JSON file properly then APK will show the URL bar.

Package Name:package_name”  is the value of the applicationId attribute.

SHA-256 Fingerprint: You can generate “sha256_cert_fingerprints” using below command in terminal
Release command “keytool -exportcert -list -v \-aliaskeystorealias -keystore keystorefile.jks”
Debug command  “keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android”

At the last put generated file at your host in the folder “.well-known“. It will be accessible publicly https://example.com/.well-known/assetlinks.json.

References:

https://developers.google.com/web/fundamentals/integration/webapks

https://developers.google.com/web/updates/2019/02/using-twa

 

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close