There are several libraries for rating, but all of them force using AlertDialog, and leaves no area for customization; as it doesn't expose it's internal conditions-checking-api.
This library does just that: a rating-conditions-checking-api that leaves the UI part on the developer.
initialize the library at a starting point in your app :
RateConditionsMonitor.init(context = this@MainActivity) {
applyConditions(launchTimes = 3, remindTimes = 7, debug = true)
//launchTimes: how many app launches it takes to ask for rating.
//remindTimes: how many app launches it takes to ask for rating after RateConditionsMonitor.later() is called.
//debug: if true: RateConditionsMonitor.isConditionsMet is also true.
}
then in a check point in your app, check if conditions are met:
rate_btn.setOnClickListener {
if (RateConditionsMonitor.isConditionsMet)
alert {
title = "test rate"
yesButton {
//perform rating action here
RateConditionsMonitor.rated() //let the monitor know. }
/* noButton {
RateConditionsMonitor.denied() //let the monitor know.
}*/
negativeButton("later") {
RateConditionsMonitor.later() //let the monitor know.
}
}.show()
}
Make sure to check the sample.
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.mhashim6:RateConditionsMonitor:v2.0'
}