androidtrusted-web-activitytwa

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


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.


Solution

  • 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:

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