In-app reviews for your Android apps

Saamer Mansoor

This is a guest blog by Saamer Mansoor. Saamer is a tinkerer and an app developer at TheFirstPrototype.com. You can find him on Twitter @saamerm, writing on Medium, and contributing to Open Source on GitHub.

When Android’s Play Core v1.8 was released in August 2020, it added an awesome new feature to enable users to provide in-app reviews. Patrick Getzmann has been working on a binding for this library for the past few months and he recently updated it to support v1.8. This means that with just a few lines of code you can bring this feature and many others to your app.

In-app reviews improve the user experience as users dislike being taken outside their app. Apple has provided this feature since iOS 10.3 released in March 2017, so it was highly anticipated on Android. Let’s see how we can use the new Play Core library to bring this feature to Android apps.

Screenshots showing In-App Reviews on a Xamarin Android app

Play Core Library

At the start of this journey I worked closely with Patrick to update the PlayCore NuGet package that can be directly added to your Android project. Since the API is core to Android I made this PR to Patrick’s project as an example of how to use it. It shows how to create an InAppReviewService.cs in your Android project and use dependency injection to call it.

However, out of nowhere James Montemagno reached to me about integrating this functionality into his already popular Store Review Plugin. We partnered with him to make the feature more accessible through his NuGet library which already had the feature for iOS. This means that implementing this in your app is now simple!

Step 1 – Add the NuGet

The first step is to add the newly updated v3 of the Store Review Plugin NuGet to all of your projects. This will automatically add the Play Core bindings library as a dependency.

Step 2 – Call RequestReview()

Next, decide on how you want to request the review. You could trigger it when the user clicks a button, or you could manually trigger it after the user has used the app for a specific amount of time. When you want to request a review simply call this following line of code:

await CrossStoreReview.Current.RequestReview(false);

This will trigger the review process and the operating system will decide if it is presented. The boolean passed in is to determine if you are in test mode, which is great for testing your app before releasing.

Step 3 – Optional ProGuard Config

If you are releasing your app with the Link All option and have ProGuard/r8 enabled, you have to add the following in the proguard file in your Android project:

-keep class com.google.android.play.core.common.PlayCoreDialogWrapperActivity
-keep class com.google.android.play.core.review.** { *; }
-keep class com.google.android.play.core.tasks.** { *; }

Testing

Testing in-app reviews is tricky on Android, just as it is on iOS. There are many limitations to being able to test your app as you can see here. Regardless of what you try, you won’t be able to see the In-App review UI when built and distributed manually. You have to download the app from the Play Store, in order to see the UI. So, the easiest way to test this is by using Android’s “Internal App Sharing”.

And there you have it, you now have cross-platform in-app reviews for your Xamarin apps. Before, I end the post I wanted to give everyone a bit of a back story of how the entire library and integration came to be and I hope that sharing my story will encourage you to contribute to the awesome Xamarin community.

Back Story

It all started with Reddit actually. I subscribe to the Android subreddit through which I learn about the latest features. When I heard about the in-app reviews on Android, I was curious to implement it in my app too, but then I researched and learned that there weren’t any plans to have an official binding for Play Core. However, I found Patrick Getzman‘s NuGet that already had done the heavy lifting of creating a binding. At the time it only was bound against Play Core v1.7.2. Since v1.8 is needed for in-app reviews, so I simply created an issue.

A bit time later, I had a deadline creeping, so I decided to procrastinate and find anything to do instead, and that’s when I decided to update that bindings library to v1.8. With many mouse scrolls and key taps, I followed this video by Jonathan Dick and got the .AAR file for v1.8 from Android working after some trial and error! I submitted a PR and was able to use the Official Android documentation to update the example in Pat’s repository. It was a wonderful experience and glad I was able to help contribute this excellent feature.

I hope that you have found this handy, and if you use this in your apps, please share screenshots with me, or you can just say Hi!

15 comments

Discussion is closed. Login to edit/delete existing comments.

  • CK SIOW 0

    Test in huiwei phone, nothing happen after called
    await CrossStoreReview.Current.RequestReview(false);

    • James MontemagnoMicrosoft employee 0

      This will only work if there is Google Play store available.

      Also your app must be in the Testing phase and downloaded from the store for it to work.

      • Максим Кошевой 0

        What do you mean “app must be in the Testing phase”? This feature will work only for beta version of the app? Will it work for release version?

        • Saamer Mansoor 0

          Hey Максим Кошевой! I have been helping developers debug through their code using the issues on the GitHub repo for the plug-in. Could you please create one there? https://github.com/jamesmontemagno/StoreReviewPlugin
          By testing phase, he means to test it you have to download it from the Google play, either as a production, external, internal or internal app sharing. It is similar to the limitation of iOS.

  • Priyanka Kondapuram 0

    I didn’t get this to work. First of all I was not able to use await and false param like this
    await CrossStoreReview.Current.RequestReview(false);
    But instead I could access CrossStoreReview.Current.RequestReview(); so I called it and then I downloaded the app in emulator from playstore through the Internal App Sharing setup, but nothing happening, the In-App Review didn’t show up.

    • Saamer Mansoor 0

      Hey Priyanka! I have been helping developers debug through their code using the issues on the GitHub repo for the plug-in. Could you please create one there? https://github.com/jamesmontemagno/StoreReviewPlugin
      But it seems like you might be able to fix it by simply calling ‘CrossStoreReview.Current.RequestReview(false);’

  • Sheharyar Shahid 0

    I’ve installed the 3.0.0 beta version of the Store Review plugin and tried to call RequestReview() but nothing happened. Currently trying to use it in Xamarin Forms UWP app although my app is published to Microsoft Store.

    • Saamer Mansoor 0

      Hey Sheharyar! This article specifically talks about the Android implementation. Could you please create an issue in the GitHub repo for the plug-in so we can resolve the UWP issue you are having? https://github.com/jamesmontemagno/StoreReviewPlugin

  • Denys Vega 0

    Superb feature! Very useful for any app. I will update my apps to use in-app review. Thanks!

    • matlab prozhe 0

      It was very interesting, the question I have is whether this feature is only on Android operating systems or does it work on iOS operating system as well?

    • Saamer Mansoor 0

      Denys! Thank you for your comment! I agree, I hope you were able to implement it successfully! Don’t forget to take a screenshot of it and share it with me 🙂

  • Kurt 0

    I wasn’t able to get this to work yet either. I have the app in an internal testing track. I downloaded it from the app store. I made sure I do not currently have a review for the app. The call to “await CrossStoreReview.Current.RequestReview(false);” doesn’t seem to do anything. Has anyone got this to work, and if so, is there something I’m missing?

    • Kurt 0

      I wonder if this could be an Android 11 issue?

      • Saamer Mansoor 0

        Hey Kurt
        There are several possibilities to why it wasn’t working, as I mentioned there’s a long list provided by Google.

        I have been helping developers debug through their code using the issues on the GitHub repo for the plug-in. Could you please create one there? https://github.com/jamesmontemagno/StoreReviewPlugin

        Do you already have the app published in the Play Store?

Feedback usabilla icon