Programs
AFCore.programs() tells your app which programs and features the signed-in member is entitled to, and the goals their organization set for them. Use it to build entitlement-driven UI: show only what the member is enrolled in, and configure goals from the program instead of hardcoding them.
What you can do
- List the member's programs (for example SmartWalking or Gym Visits) and whether each one is active.
- Read each program's goals, such as the daily step target or the number of goal days needed per month.
- Check feature flags such as Fit@Home or Self-Report before showing their screens.
- Hide everything the member is not entitled to, including when the call fails.
Key APIs
| Call | What it is for |
|---|---|
programs().getAvailablePrograms() | The member's programs (ProgramEntitlement): name, activated and programData with the goals |
programs().getAvailableFeatures() | Feature flags (ProgramFeature): name and activated |
Example
- Android (Kotlin)
- iOS (Swift)
lifecycleScope.launch {
val programs = AFCore.programs().getAvailablePrograms().filter { it.activated }
val stepGoal = programs.firstNotNullOfOrNull { it.programData?.dailyStepsGoal }
val features = AFCore.programs().getAvailableFeatures()
.filter { it.activated }
.mapNotNull { it.name }
.toSet()
showHome(programs, stepGoal, features)
}
Task {
let programs = try await AFCore.shared.programs().getAvailablePrograms().filter { $0.activated }
let stepGoal = programs.compactMap { $0.programData?.dailyStepsGoal }.first
let features = Set(try await AFCore.shared.programs().getAvailableFeatures()
.filter { $0.activated }
.compactMap { $0.name })
showHome(programs, stepGoal, features)
}
Read entitlements after sign-in and refresh them per session rather than on every screen. When a feature flag is missing or the call fails, keep the feature hidden.
Learn more
See the API Reference. Complete integration guides are in AIDE Docs.