I've got a progressive web app, app.example.com
created using Chrome's "Add to Home Screen" button on Android.
I have an NFC tag that ordinarily opens app.example.com/nfc_app
in Chrome when it's tapped.
How can I make it so that this NFC tag opens up the app.example.com/nfc_app
PWA instead of Chrome when tapped?
Add a helper application as a work-around:
Your AndroidManifest.xml listens for your target url:
Now when you scan your tag, the NFC Intent will be handled by the installed app which forwards to the View Intent which your Progressive Web App is registered.
For me, this only worked in Android 8, not Android 6 since apparently opening a PWA by clicking on a link in Chrome is also not supported.
An unfortunate work-around so I'm hoping to see a better answer.
Can confirm, Android 8, links on other websites or from other apps open the PWA just fine, but the NFC intent opens Chrome. Here is another workaround that doesn't require you to install a native helper APK:
Create a simple redirect HTML file
pwa.html
and serve it from a different domain, let's say other.example.com:Then, instead of having the NFC tag point to
https://app.example.com
, you would program it to point to your redirect HTMLhttps://other.example.com/pwa.html
. It's not perfect and really just a workaround, but simpler than building and installing a separate APK.