Skip to main content

🧭 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

// 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 app

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.

Debug manifest conflicts

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.


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(...)
}
}
}
}
Cross-module links

Install a module container so /sdk/training/... switches your bottom nav tab.


Embed + navigate together​

TaskAPI
Tab shows nutrition UIsdk.modules.nutrition.getFragment()
Button opens a plansdk.navigate(AzeooDestination.Nutrition.Plan(id))

See UI components and Nutrition module.


See also​