Aller au contenu principal

🚀 Démarrage rapide Android

Six étapes de zéro à l'interface nutrition.

Prérequis​

Étape 1 : Installer le SDK​

Téléchargez l'AAR depuis Téléchargements (version 1.0.9 recommandée) et configurez Maven local — guide d'installation.

Dans app/build.gradle.kts :

implementation("com.azeoo:sdk:1.0.9")
Obligatoire — filtres ABI NDK

Avant de lancer l'app, ajoutez ndk.abiFilters dans app/build.gradle.kts (votre application hôte, ce n'est pas optionnel). Voir Installation → Étape 4b pour l'extrait exact et la raison.

Étape 2 : Initialiser dans Application ou Activity​

import com.azeoo.sdk.AzeooConfig
import com.azeoo.sdk.AzeooDeepLinkConfig
import com.azeoo.sdk.AzeooSDK
import com.azeoo.sdk.AzeooSafeAreaConfig

private fun initializeSDK() {
val config = AzeooConfig(
locale = "en",
analyticsEnabled = true,
offlineEnabled = true,
connectionTimeoutSeconds = 30L,
persistSession = true,
)
val deepLinks = AzeooDeepLinkConfig(scheme = "https", host = "azeoo.com")
val safeArea = AzeooSafeAreaConfig(top = true, bottom = true, left = true, right = true)

AzeooSDK.initialize(
context = applicationContext,
apiKey = "YOUR_API_KEY",
config = config,
theme = themeConfig, // optional — see ThemeHelper in example
deepLinks = deepLinks,
safeArea = safeArea,
) { error ->
if (error != null) { /* show error UI */ return@initialize }
// Show login / connect UI
}
}
Utilisez initialize, pas init

Utilisez initialize, pas init. Attendez le callback avant connectUser.

Étape 3 : Connecter lorsque l'utilisateur est connecté​

AzeooSDK.shared.connectUser(
token = userJwt,
gender = user.gender,
height = user.height,
weight = user.weight,
) { profile, error ->
if (error != null) return@connectUser
// profile?.id is the Azeoo user id — navigate to main UI
}

Ne passez pas userId — il est renvoyé dans profile.

Étape 4 : Intégrer le Fragment nutrition​

val fragment = AzeooSDK.shared.modules.nutrition.getFragment(bottomSafeArea = false)
childFragmentManager
.beginTransaction()
.replace(R.id.flutter_container, fragment)
.commitNow()

Entraînement : modules.training.getFragment(...).

Étape 5 : Synchronisation barre d'onglets (optionnel)​

Si vous utilisez une navigation inférieure :

sdk.setModuleContainer(
AzeooBottomNavCoordinator(
bottomNav = bottomNavigation,
mapping = mapOf(
AzeooDestination.Module.NUTRITION to R.id.nav_nutrition,
AzeooDestination.Module.TRAINING to R.id.nav_training,
),
)
)

Voir Navigation et le catalogue des destinations.

Étape 6 : Déconnexion​

AzeooSDK.shared.disconnect { }

Démontage complet : dispose() puis initialize à nouveau.

Étapes suivantes​