isMembershipActive

abstract suspend fun isMembershipActive(): AFResult

Checks if the user’s membership is active.

Useful for gating access to premium features or providing messaging when a membership is inactive.

Return

AFResult indicating whether access is allowed, with an optional message URL (e.g., renewal instructions).

Throws

if the check fails.

Android (Kotlin)

lifecycleScope.launch {
try {
val status = AFCore.applicationSettings().isMembershipActive()
if (status.allowed) unlockPremium() else showMessageUrl(status.messageUrl)
} catch (t: Throwable) {
showError("Could not verify membership: ${t.message}")
}
}

iOS (Swift)

Task {
do {
let status = try await AFCore.shared.applicationSettings().isMembershipActive()
if status.allowed { self.unlockPremium() }
else { self.showMessageUrl(status.messageUrl) }
} catch {
self.showError("Could not verify membership: \\(error.localizedDescription)")
}
}