Skip to content

uny/in-app-review-kotlin

Repository files navigation

in-app-review-kotlin

Compose Multiplatform-first in-app review prompts for Android (Google Play) and iOS (App Store).

Maven Central License CI

Neither Google Play's in-app review API nor SKStoreReviewController guarantees the dialog is shown, or that the user actually submits a review — both platforms apply their own frequency quota internally. This library does not pretend otherwise: requestReview() returns a ReviewResult that only ever confirms the request was accepted, never that a review was written.

Supported platforms

Platform Backend Min OS
Android Google Play In-App Review API API 24+
iOS SKStoreReviewController iOS 14+

Installation

gradle/libs.versions.toml:

[libraries]
in-app-review = { module = "dev.ynagai.inappreview:in-app-review-kotlin", version = "0.1.0" }

build.gradle.kts:

kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation(libs.inAppReview)
        }
    }
}

Usage

@Composable
fun WorkoutSummaryScreen() {
    val reviewManager = rememberInAppReviewManager()
    val scope = rememberCoroutineScope()

    Button(onClick = {
        scope.launch { reviewManager.requestReview() }
    }) {
        Text("Finish")
    }
}

Call requestReview() after a moment of genuine engagement (a completed task, not a raw button tap) — never on first launch, and never gate it behind a "would you rate us 5 stars?" pre-question. Apple limits the dialog to at most 3 prompts per user per 365 days regardless of how often you call it; Google gives no guarantee at all.

Testing

Neither platform's real dialog is testable in a debugger or simulator/emulator in the way you'd expect (Android requires an internal test track; iOS always shows the dialog in debug builds but ignores calls from TestFlight). Use FakeInAppReviewManager to exercise your call-site logic without depending on either:

val reviewManager: InAppReviewManager =
    if (isDebug) FakeInAppReviewManager() else rememberInAppReviewManager()

License

Apache License 2.0, see LICENSE.

About

Compose Multiplatform-first in-app review prompts for Android (Google Play) and iOS (App Store), with honest result semantics and a built-in test mode.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages