How to create a “Rate This App” Dialog to request Google Play rating
As a developer, it is important to get feedback from your users. Their opinions on your app determine how they feel about using your app enabling you to make informed decisions about future updates and such. In this article, I will demonstrate using an Android library to create a custom Alert Dialog to prompt the user to rate your app. You have the option to preset the number of install days, launch times and remind intervals after the user installs your app to show the alert dialog. I will use a library called Android Rate for this app.
Import the library
We have to first import the library and add it to our build.gradle
file.
implementation 'com.github.hotchemi:android-rate:1.0.1
Afterwards, sync the project.
Add custom strings
We then have to move to our strings.xml
file and add a couple of strings for our custom alert dialog. Add the following lines to the file.
MainActivity
We then move to our MainActivity
where we will implement the alert dialog. We will add the following lines of code to our onCreate
function.
You can change the number of install days, launch times and remind intervals as you see fit. In our case, the alert dialog will be shown one day after the user installs the app and launches it three times. If the user clicks on ‘Rate It Now’ the user is directed to the PlayStore as the library picks the URL of the app on Google Play. If the user clicks on ‘Remind Me Later’ the dialog will prompt after two more launches. This is a great method to gather feedback from your users to prompt them to rate your app on the Google PlayStore.