get Location Categories
Lists the categories a nomination can be filed under, driving the form's category picker.
Use it to fill the category picker, or to look up a category id by its code. The catalog is runtime data - read it rather than hard-coding ids. A gym-only app can skip the picker and preset the fitness category (code FavoriteLocation.FITNESS_CATEGORY). Then load the category's types with getLocationTypes.
Android (Kotlin)
lifecycleScope.launch {
try {
val categories = AFCore.locations().getLocationCategories()
val fitness = categories.firstOrNull {
it.code.equals(FavoriteLocation.FITNESS_CATEGORY, ignoreCase = true)
}
showCategoryPicker(categories, preselected = fitness)
} catch (t: Throwable) {
showError(t)
}
}Content copied to clipboard
iOS (Swift)
Task {
do {
let categories = try await AFCore.shared.locations().getLocationCategories(activeOnly: true)
let fitness = categories.first { $0.code?.uppercased() == "FITNESS" }
showCategoryPicker(categories, preselected: fitness)
} catch {
showError(error)
}
}Content copied to clipboard
Return
The list of LocationCategory.
Parameters
active Only
true (default) returns only active categories.
Throws
if the list cannot be retrieved. Note the server degrades an upstream failure to an empty 200 on this route, which the SDK cannot distinguish from a genuinely empty catalog.