TWA bases app sometime showing URL and sometime working, even Assetlink.json uploaded properly

279 views Asked by At

I have website (https://www.kriscent.com/product/kart-supermarket/). I created PWA of that after that I uploaded it on Play store by using TWA(Trusted Web Activities), App URL is https://play.google.com/store/apps/details?id=in.kriscent.kartlite. The URL of website always show in app, So I uploaded the assetlink.json (URL: https://www.kriscent.com/.well-known/assetlinks.json). After uploading the assetlinks.json, When I run my app, the website URL disappeared but when I switched on other link in the app then the URL shows again. I don,t know what is happening. Please help me if anybody has idea to resolve this issue.

enter image description here

enter image description here

1

There are 1 answers

0
andreban On

The problem is that, when navigating to a product detail page, you are using a different origin than the one used to open the Trusted Web Activity and that doesn't have Digital Asset Links setup:

  • When the application is started, it opens https://www.kriscent.com/, which is correctly validated.
  • When clicking on a product, the user is take to https://kriscent.com/ (without www), which is a different origin, and is not validated in the Android app.

It is possible to get the Trusted Web Activity to work with multiple origins but, in this case, I'd recommend using a single origin for the initial URL and the navigations, as you will be able to take advantage of using the same service worker, browser storage, etc.