SuddenH4X / awesome-app-rating

An Android library providing a dialog, which asks the user to rate the app or give feedback. You can also use the library to show the Google in-app review easily under certain conditions.
Apache License 2.0
231 stars 40 forks source link

Incrementing launchTimes when Orientation Change #56

Closed inidamleader closed 3 years ago

inidamleader commented 3 years ago

I think there is a solution for this: Use a static field (or companion object field in kotlin) "instanceNbr" in the class that invoke increaseLaunchTimes() function This field must be incremented at each RateApp.builder instanciation, and then use it as a condition to call increaseLaunchTimes() function:

data class Builder(var activity: AppCompatActivity) {
    ...
    init {
        // By using instanceNbr the launchTimes will be incremented just at start of the application
        // Recreate activity without killing the process will not call increment SharePref LaunchTimes
        if (++instanceNbr == 1)
            activity.increaseLaunchTimes()
    }
    ...
    companion object {
        private var instanceNbr = 0
        ...
    }
    ...
}
SuddenH4X commented 3 years ago

Hi @inidamleader, I'm not sure if I get your issue right. Did you read the following section of the readme? If that doesn't solve your issue please describe you problem a little bit more.