How can I extend TWA application with In-App review?

572 views Asked by At

i create my TWA app based on this repo: https://github.com/GoogleChromeLabs/svgomg-twa

I would like to extend the code with In-App Review https://developer.android.com/guide/playcore/in-app-review

Is it possible to do this? I am front-end developer. I have no knowledge of android application

Maybe i can listen to url change? For example in html create anhor

<a href="/#openReviewForm">Rate app now!</a>

and app listen and check current hash in location.

1

There are 1 answers

0
andreban On BEST ANSWER

Nowadays, I'd recommend using @bubblewrap/cli to bootstrap the Trusted Web Activity project, as svgomg-twa has been deprecated and replaced by Bubblewrap.

In short, yes, it is possible to integrate in-app-reviews in a Trusted Web Activity.

The general approach is to use a custom schema, like my-app:// that is handled by an Android Activity. This Activity will, in turn, launch the review flow and then finish itself.

There are some caveats though:

  • You'll need to check if the all is in "trusted web activity mode" in order to display the link, as it only works when inside a Trusted Web Activity.
  • This may also not be compatible with Chrome OS, so if you are also deploying the Trusted Web Activity there, I wouldn't recommend integrating in-app reviews.

Here's a blogpost with more details on how to do it.