HomeAndroidHow one can add Google Play In-app Evaluate Dialog?

How one can add Google Play In-app Evaluate Dialog?


That is only a fast information and a easy instance of how you can add the Google Play In-app assessment dialog in your app. That is what it appears like after I applied this in RSS feed reader app.

1. Add Evaluate API Libraries

This instance of construct.gradle.kts (Kotlin script/KTS) in your app module.

dependencies {
    
    implementation("com.google.android.play:assessment:2.0.1")
    implementation("com.google.android.play:review-ktx:2.0.1")
    
}

2. Create ReviewManager within the Exercise

It’s higher to implement the ReviewManger in exercise relatively than a composable perform as a result of its APIs wants an exercise. Properly, you may technically do it in composable perform (by LocalContext), however it’s not a very good observe as a result of composable capabilities should not have to know in regards to the exercise.

This creates the ReviewManager utilizing ReviewManagerFactory.create() API in your exercise. In fact, solely when it’s accessed due to the lazy delegate is used right here.

class MainActivity : ComponentActivity() {
    
    non-public val reviewManager by lazy {
        ReviewManagerFactory.create(this)
    }
    
}

3. Add showReviewDialog() Perform

Let’s create a perform that requests the assessment stream and launch the assessment dialog.

class MainActivity : ComponentActivity() {
    
    non-public enjoyable showReviewDialog() {
        val request = reviewManager.requestReviewFlow()
        request.addOnCompleteListener { job ->
            if (job.isSuccessful) {
                val reviewInfo = job.outcome
                reviewManager.launchReviewFlow(this, reviewInfo)
            }
        }
    }
    
}

Then, set this perform to be a callback out of your composable perform.

override enjoyable onCreate(savedInstanceState: Bundle?) {
    
    setContent {
        
        MainScreen(showReviewDialog = ::showReviewDialog)
    }
}

What I did is solely add a drop-down “Fee Me” menu to the app.

Properly, that is for academic functions and is just not beneficial to implement this manner as a result of there are no callbacks to point whether or not Google Play assessment dialog is proven or not. If the dialog is just not proven (for the explanations beneath), this seems to be a damaged consumer stream which we need to keep away from!

There are quotas on what number of occasions this API might be known as. Clicking the “Fee Me” the second time, will not present the Google Play assessment dialog anymore. I additionally seen when you’ve got already reviewed the app, name the ReviewManager.launchReviewFlow() API does nothing too.

For extra data, you may discuss with the official doc right here.

4. Check In-app Evaluations

The difficulty is you may’t take a look at it in your emulator immediately as a result of it requires your app to be printed in Play Retailer.

There are a couple of methods you may check it out (as you may learn from the documentation right here) however the easiest method in my view is inner app sharing.

Listed below are the steps to add your app for inner app sharing:

  1. In Google Play Console, go to Setup -> Inside App Sharing

  2. Create an Inside Testers e mail lists. Separate the emails with a comma.

  3. In Handle testers, choose Limit entry to e mail lists

  4. In Handle uploaders, click on this hyperlink, https://play.google.com/console/internal-app-sharing. After that, you may add your app bundle or APK right here.

  5. Copy the hyperlink and despatched it to your testers (it could possibly be your self). The tester must open the hyperlink on his/her telephone and it appears like this. Click on OPEN IN PLAY STORE APP.

  6. You get this in case your Google Play has not enabled Inside app sharing. Click on the Google Play Settings.

  7. In Google Play Settings, go to About, and click on Play Retailer Model 7 occasions. This permits the developer choices.

  8. Go to Basic -> Developer choices, and allow the Inside app sharing. You get this immediate, so simply click on Activate.

  9. Return to step 5, and click on OPEN IN PLAY STORE APP once more. It brings you to Google Play Retailer, to put in the app.

    If the app has already been put in beforehand, it asks you to uninstall it first.

  10. Now, it’s best to be capable of take a look at the Google Play In-App Evaluate Dialog.

On this testing mode, the quotas don’t apply right here. You’ll be able to name this Google Play In-App assessment API as many occasions as you want. The one factor is the Submit button is disabled.

Conclusion

Implementing the Google Play in-app assessment dialog is kind of easy, however testing is a bit difficult. It is going to be good if we are able to check it out immediately from the emulator.

Deciding when to set off the in-app assessment can also be a bit difficult for a quite simple app like this one. Not like video games after the participant completed a stage, you may set off in-app critiques.

Possibly I can do one thing like prompting the in-app assessment after the consumer put in the app after a sure interval? Yeah, I’ll try this subsequent.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments