Aller au contenu principal

Android API Reference

API reference for the Azeoo SDK on Android. The current flow is AzeooSDK.init(...) then connect(userId, token); see Android Quick Start and SDK API.

AzeooSDK

Single entry point. init(context, apiKey, config, theme, deepLinks, safeArea, ...) returns the SDK instance; use AzeooSDK.shared thereafter. connect(userId, token, callback) attaches a user. onReady(callback), isReady, disconnect, dispose. Access user, theme, navigation, modules.nutrition, modules.training after connect.

Coroutine Version

suspend fun initializeAsync(
context: Context,
apiKey: String
): AzeooClient

AzeooClient

The main client class for API communication.

Properties

  • apiKey: String - The API key used for initialization
  • subscriptions: List<String> - List of active subscriptions
  • isAuthenticated: Boolean - Authentication status

Methods

suspend fun validateApiKey(): Boolean

Validates the API key with the server.

AzeooUser

User management and profile operations.

Initialization

class AzeooUser(
client: AzeooClient,
userId: String
)

Methods

suspend fun logout()

Logs out the current user and clears user-specific data.

suspend fun changeHeight(height: Double)

Updates the user's height.

suspend fun changeWeight(weight: Double)

Updates the user's weight.

suspend fun getProfile(): UserProfile

Retrieves the user's profile information.

suspend fun getToken(): String

Gets the current authentication token.

suspend fun update(data: Map<String, Any>)

Updates user information.

suspend fun delete()

Deletes the user account.

AzeooUI

UI components and navigation management.

Initialization

fun initialize(
client: AzeooClient,
config: SDKConfig,
callback: (Error?) -> Unit
)

Instance Access

val instance: AzeooUI?

Nutrition Module

val nutrition: NutritionModule

Methods

fun showMainScreen(bottomSafeArea: Boolean? = null)

Shows the main nutrition screen.

fun showNutritionPlans()

Shows the nutrition plans screen.

fun showNutritionPlan(planId: String)

Shows a specific nutrition plan.

fun showUserNutritionPlan()

Shows the user's nutrition plan.

fun showRecipes()

Shows the recipes screen.

fun showRecipe(recipeId: Int, recipeName: String? = null)

Shows a specific recipe.

fun showBarcodeScanner()

Shows the barcode scanner.

fun showMobileScanner()

Shows the mobile scanner.

fun showCart()

Shows the shopping cart.

fun showNutritionSearch()

Shows the nutrition search screen.

fun showAddSelection()

Shows the add selection screen.

fun showAddFood()

Shows the add food screen.

fun showAddMeal()

Shows the add meal screen.

Training Module

val training: TrainingModule

Methods

fun showMainScreen()

Shows the main training screen.

fun showWorkoutPlans()

Shows the workout plans screen.

fun showExercises()

Shows the exercises screen.

fun showProgress()

Shows the progress screen.

fun showSchedule()

Shows the schedule screen.

Theme Management

fun changePrimaryColor(color: Int)

Changes the primary color for both light and dark themes.

fun setLightMode()

Sets theme mode to light.

fun setDarkMode()

Sets theme mode to dark.

fun setSystemMode()

Sets theme mode to follow system setting.

suspend fun toggleThemeMode()

Toggles between light and dark theme modes.

Reset

suspend fun reset()

Resets the SDK, clearing user-specific data.

SDKConfig Builder

Configuration builder for SDK initialization.

class SDKConfig {
class Builder {
fun setUserId(id: String): Builder
fun setAuthToken(token: String): Builder
fun setLocale(locale: String): Builder
fun setAnalyticsEnabled(enabled: Boolean): Builder
fun setOfflineSupport(enabled: Boolean): Builder
fun setTheme(theme: ThemeConfig): Builder
fun setSafeArea(safeArea: SafeAreaConfig): Builder
fun setDeepLinkConfig(config: DeepLinkConfig): Builder
fun build(): SDKConfig
}
}

Error Types

sealed class AzeooSDKError : Exception() {
object InvalidApiKey : AzeooSDKError()
object NetworkError : AzeooSDKError()
object InitializationError : AzeooSDKError()
object AuthenticationError : AzeooSDKError()
object ConfigurationError : AzeooSDKError()
}

Next Steps