π§ Android β Navigation
Typed navigation with AzeooDestination after connectUser.
Prerequisitesβ
AzeooSDK.initialize(context, apiKey, /* theme, deepLinks, β¦ */)
AzeooSDK.shared.connectUser(token, gender, height, weight) { result -> β¦ }
val sdk = AzeooSDK.shared
Navigate to a screenβ
// Meal plan
sdk.navigate(AzeooDestination.Nutrition.Plan(id = "summer-plan-2025"))
// Recipe with display name
sdk.navigate(AzeooDestination.Nutrition.Recipe(id = 12345L, name = "Grilled Chicken"))
// Diary for yesterday (epoch ms)
sdk.navigate(AzeooDestination.Nutrition.Diary(date = yesterdayMs))
// AI scanner
sdk.navigate(AzeooDestination.Nutrition.Scanner(kind = ScannerKind.AI))
// Cross-module β from nutrition tab to training
sdk.navigate(AzeooDestination.Training.Workouts)
Supporting enums:
enum class ScannerKind { BARCODE, MOBILE, AI }
enum class MealType { BREAKFAST, LUNCH, DINNER, SNACK }
Full destination table: Destination catalogue.
Stack APIβ
sdk.navigate(AzeooDestination.Nutrition.Search())
sdk.back()
sdk.backToRoot()
sdk.canGoBack { canPop -> β¦ }
sdk.navigation.getCurrentRoute { route -> Log.d("Azeoo", route) }
Access via sdk or sdk.navigation depending on your SDK version surface β both route to the same implementation.
Module containersβ
Use when you have BottomNavigationView, NavigationRail, or Jetpack Navigation with separate nutrition / training destinations.
sdk.setModuleContainer(AzeooBottomNavCoordinator(
bottomNav = findViewById(R.id.bottom_nav),
mapping = mapOf(
AzeooDestination.Module.NUTRITION to R.id.nav_nutrition,
AzeooDestination.Module.TRAINING to R.id.nav_training,
),
))
example/android β MainActivity installs the coordinator after connect.
Navigation rail / Jetpack Nav: use AzeooNavigationRailCoordinator or AzeooNavComponentCoordinator with the same mapping idea.
Back navigationβ
System back and predictive back are handled by default.
When the user is at the root of a module stack, back sends the task to background (moveTaskToBack) instead of finishing your Activity.
Predictive back (Android 13+)β
The SDK merges android:enableOnBackInvokedCallback="true" into your app manifest.
If a dependency (e.g. expo-dev-launcher) sets enableOnBackInvokedCallback="false" in a debug overlay, merge may fail. In your debug manifest:
<application
android:enableOnBackInvokedCallback="true"
tools:replace="android:usesCleartextTraffic,android:enableOnBackInvokedCallback"
... />
Custom exit dialogs: register an OnBackPressedCallback with higher priority than the SDKβs.
Deep linksβ
1. Configure at initializeβ
AzeooSDK.initialize(
context = this,
apiKey = apiKey,
deepLinks = AzeooDeepLinkConfig(
scheme = "yourapp",
host = "yourapp.com",
pathPrefix = "/sdk",
),
)
2. Intent filterβ
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="yourapp.com" android:pathPrefix="/sdk" />
</intent-filter>
3. Forward URIβ
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
intent.data?.let { uri ->
sdk.navigation.handleDeepLink(uri) { handled ->
if (!handled) {
// optional: parse and sdk.navigate(...)
}
}
}
}
Install a module container so /sdk/training/... switches your bottom nav tab.
Embed + navigate togetherβ
| Task | API |
|---|---|
| Tab shows nutrition UI | sdk.modules.nutrition.getFragment() |
| Button opens a plan | sdk.navigate(AzeooDestination.Nutrition.Plan(id)) |
See UI components and Nutrition module.