subscriptionStatus
A StateFlow property that indicates the subscription status of the user.
If you're using a custom PurchaseController
, you must update this property whenever the user's entitlements change.
You can also observe changes via the SuperwallDelegate
method subscriptionStatusDidChange(from, to)
.
Purpose
Indicates the current subscription status of the user and can be observed for changes using Kotlin StateFlow.
Signature
Parameters
This property accepts a SubscriptionStatus
sealed class value:
SubscriptionStatus.Unknown
- Status is not yet determinedSubscriptionStatus.Active(Set<String>)
- User has active entitlements (set of entitlement identifiers)SubscriptionStatus.Inactive
- User has no active entitlements
Returns / State
Returns a StateFlow<SubscriptionStatus>
that emits the current subscription status. When using a PurchaseController
, you must set this property yourself using setSubscriptionStatus()
. Otherwise, Superwall manages it automatically.
Usage
Set subscription status (when using PurchaseController):
Get current subscription status:
Observe changes with StateFlow:
Jetpack Compose observation:
Java usage:
How is this guide?