Skip to content

Add Google Play In-App Review prompt (positive-moment trigger, F-Droid-safe) #172

Description

@almothafar

What problem does this solve?

The app carries a 3.6★ from its earlier buggy behaviour. With the bugs fixed and the BattWatch relaunch (companion rebrand issue), the fastest way to move the displayed rating is fresh, positive reviews — Google Play weights recent ratings far more heavily than the lifetime average. Right now there's no in-app prompt, so only motivated (often unhappy) users leave reviews.

Proposed solution

Add the Google Play In-App Review API (ReviewManager, com.google.android.play:review:2.0.2 — this is Java, so the non-ktx artifact).

Trigger at a genuine positive moment

  • e.g. when the user opens Battery Insights and sees healthy data, or after N successful app sessions / days with no crash.
  • Never after an alert, mid-task, or on first launch.
  • Cap to at most once per long interval and persist that we asked (SharedPreferences), independent of whether the sheet actually showed.

Respect Play policy (these are hard rules, not style)

  • Do not gate by sentiment. You may not show a "Are you enjoying BattWatch? → only happy users go to the review sheet" pre-prompt that filters who sees it — that violates Play's In-App Review guidelines and risks enforcement.
  • The API is quota-throttled and may silently no-op — the sheet is not guaranteed to appear. Never block UI on it, never tell the user "please rate now" expecting the dialog, and don't verify whether they reviewed.

F-Droid / non-Play safety (interacts with #4)

com.google.android.play:review is a proprietary Play library — it will conflict with F-Droid inclusion (#4) and is a no-op on degoogled devices. Handle deliberately:

  • Preferred: a product flavor (play vs foss) so the FOSS/F-Droid build has zero Play dependency and the code path is compiled out, or
  • a runtime GoogleApiAvailability guard that skips the Play path when Play Services/Store is absent.
  • On the non-Play path, fall back to a plain "Rate us / Star on GitHub" action rather than nothing.

Wire into the existing feedback flow

Complement MainActivity's feedback chooser (GitHub / email) — the in-app review is an additional, unobtrusive prompt, not a replacement for the existing explicit feedback paths.

Acceptance criteria

  • In-app review requested at a positive, non-intrusive moment; asked at most once per long interval; state persisted
  • No sentiment-gating pre-prompt; nothing in the app depends on the sheet actually showing
  • FOSS/F-Droid build has no Play dependency (flavor) or degrades gracefully (runtime guard) with a manual rate/GitHub fallback
  • minSdk 26 path verified; no crash when Play Store is absent
  • Trigger logic is a pure, unit-tested decision helper (when-to-ask), matching the project's testable-core pattern

Related: BattWatch rebrand (companion issue), #4 (F-Droid — the flavor/guard decision here affects inclusion).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions