androidgoogle-playgoogle-play-servicesgoogle-play-core

Google Play In-App Review API: How long is the ReviewInfo object valid?


In the documentation it's stated that the ReviewInfo object is only valid for a limited amount of time:

Note: The ReviewInfo object is only valid for a limited amount of time. Your app should request a ReviewInfo object ahead of time (pre-cache) but only once you are certain that your app will launch the in-app review flow.

How long (roughly) is the ReviewInfo object valid?

For example, can a game fetch the ReviewInfo at startup (if the user has played long enough), and then launch the review flow only if the user beats their high score, which could be 5, 10, 30 minutes down the line?


Solution

  • As stated in the docs:

    https://developer.android.com/guide/playcore/in-app-review/kotlin-java#request-review-info

    Note: The ReviewInfo object is only valid for a limited amount of time. Your app should request a ReviewInfo object ahead of time (pre-cache) but only once you are certain that your app will launch the in-app review flow.

    While you could potentially discover the TTL, it's an implementation detail, thus relaying on it could backfire.

    I would not recommend to load on Application create, instead use some logic to guard the request.

    For example, it's a common practice to try to display the request after screen transition once the user did an action successfully or whatever logic you want to apply. Meaning that on the previous screen you could start the request already and only once the new screen appears launch the flow.

    See the PlayCoreKtx sample for an example https://github.com/android/app-bundle-samples/blob/master/PlayCoreKtx/app/src/main/java/com/google/android/samples/dynamicfeatures/state/ReviewViewModel.kt