Migrating from v0? See the Android 0 → 4 migration guide.Requirements: Kotlin 2.0.0+ · Java 8+ · Min SDK 23 · Compile SDK 35
1. Install the SDK
Add repositories
EnsuremavenCentral() and google() are present in your settings.gradle.kts:
If you don’t have adependencyResolutionManagementblock, addgoogle()andmavenCentral()to yourpluginManagement { repositories { ... } }block instead.
Add the dependency
2. Initialize Helium
Initialize as early as possible in your app’s lifecycle — before any paywall is shown. Your API key is available in the Helium dashboard → Profile.- Application (recommended)
- Activity
HeliumEnvironmentacceptsPRODUCTIONorSANDBOX. When in doubt, usePRODUCTION— Helium automatically treats debug builds as sandbox.
3. Show a Paywall
Before callingpresentPaywall, make sure you have a trigger and workflow configured in the Helium dashboard.
Recommended Setup
The following steps are optional but strongly recommended for production apps.Identify Users
User identification is optional. It improves targeting accuracy and event attribution in external analytics. Identify users before callingHelium.initialize to ensure consistency from the first session.
Paywall Events
Helium emits events throughout the paywall lifecycle. You can handle them per-presentation or globally.Per-presentation handlers
Pass aPaywallEventHandlers instance when calling presentPaywall, or register it with addPaywallEventListener. Passing a LifecycleOwner is recommended — the listener is removed automatically when the lifecycle is destroyed.
If you don’t pass aLifecycleOwner, callremoveHeliumEventListener()manually to avoid memory leaks.
Global event listener
ImplementHeliumEventListener for centralized event handling across all paywalls:
Fallback Paywalls
Set up fallbacks to handle the rare case where a paywall fails to load. This is strongly recommended before going to production. Follow the fallback bundle guide once you have a production paywall ready.Checking Entitlements
Check entitlement status before showing a paywall to avoid showing it to users who are already subscribed.All Entitlement Methods
All Entitlement Methods
Advanced
Consumables
If your app sells consumable products (e.g. coins, credits, tokens), register their product IDs so Helium knows to consume them after purchase:This only applies when using the defaultPlayStorePaywallDelegate. If you’re usingRevenueCatPaywallDelegate, configure consumption in RevenueCat. If you’re using a custom delegate, you’re responsible for consuming purchases yourself.
RevenueCat Integration
By default, Helium manages purchases directly. If you’re already using RevenueCat, use theRevenueCatPaywallDelegate to keep RevenueCat in control.
Install
Add the RevenueCat module toapp/build.gradle.kts:
Configure
Set the delegate before callingHelium.initialize, and make sure RevenueCat is already initialized:
Keeping appUserID in sync
If you change the RevenueCatappUserID, sync the value to Helium:
Custom Purchase Handling
By default, Helium handles purchases for you. This section is for apps that need custom purchase logic.Tip: If you only need to augment the built-in logic, subclassTo fully replace purchase handling, implementPlayStorePaywallDelegateorRevenueCatPaywallDelegateand callsuperon any methods you override.
HeliumPaywallDelegate:
Additional Methods
Check Download Status
Check Download Status
In most cases you don’t need this — Helium shows a loading indicator automatically if the paywall hasn’t finished downloading.
downloadStatus is a Kotlin Flow that emits HeliumConfigStatus states:Hide Paywalls Programmatically
Hide Paywalls Programmatically
Reset Helium
Reset Helium
Resets Helium so
initialize can be called again. Useful after changing user traits that affect paywall targeting.