Skip to content

Fix: Fix crash when Google Play billing service disconnects#446

Merged
d4rken merged 2 commits intomainfrom
fix/billing-service-disconnect-crash
Mar 12, 2026
Merged

Fix: Fix crash when Google Play billing service disconnects#446
d4rken merged 2 commits intomainfrom
fix/billing-service-disconnect-crash

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented Mar 12, 2026

What changed

Fixed a crash that could happen when the Google Play billing service disconnects unexpectedly (e.g., during a Play Store update or when the OS kills the billing process).

Technical Context

  • Root cause: After BillingClientConnectionProvider's 5 retry attempts are exhausted, the BillingException propagates to BillingDataRepo.connectionProvider which had a .catch { throw it } before .replayingShare(scope). The re-throw causes shareIn's internal coroutine to fail with an unhandled exception in the SupervisorJob-based AppScope, crashing the app.
  • Fix: Replaced the .catch { throw it } with .retryWhen that retries indefinitely with 60s backoff. This keeps the SharedFlow alive — when the billing service returns, the connection re-establishes automatically.
  • The existing upgradeInfo flow already has onStart fallback values (grace period), so the UI isn't blocked during retry waits.

@d4rken d4rken added the bug Something isn't working label Mar 12, 2026
@d4rken d4rken merged commit 1ceac34 into main Mar 12, 2026
9 checks passed
@d4rken d4rken deleted the fix/billing-service-disconnect-crash branch March 12, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant