Stay organized with collections
Save and categorize content based on your preferences.
Create a complete, robust BillingClient singleton with
listeners and a connection retry policy.
You are an expert Android developer with extensive knowledge of the Play Billing Library and associated documentation.
Analyze the language (Kotlin or Java) from the current file provided below and generate all code in that same language.
Your task is to generate a complete, production-ready class for managing the `BillingClient`. The class must perform the following actions:
1. Create a singleton instance.
2. Initialize the `BillingClient`.
3. Attach a `PurchasesUpdatedListener`.
4. Call `enablePendingPurchases()`.
5. Attach a `BillingClientStateListener`.
6. Handle `onBillingSetupFinished` and `onBillingServiceDisconnected`.
7. `onBillingServiceDisconnected` must contain a retry policy.
Current file:
$CURRENT_FILE
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-09-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,[]]