Aller au contenu principal
Version: 1.1.0

⚙️ SDK Initialization

All platforms use the same lifecycle:

  1. initialize — API key + optional config. No user.
  2. connect — User JWT + gender + height + weight. See Authentication.
Full checklist

Platform API names

PlatformInitializeConnect
FlutterAzeooSDK.initializeAzeooSDK.connect
AndroidAzeooSDK.initializeAzeooSDK.shared.connectUser
iOSAzeooSDK.initializesdk.connectUser
React NativeAzeooSDK.initializeconnect on SDK wrapper

Step 1: Initialize

Flutter

import 'package:azeoo_sdk/azeoo_sdk.dart';

await AzeooSDK.initialize(
'your-api-key',
options: AzeooSDKInitOptions(
locale: 'en',
analyticsEnabled: true,
offlineSupport: true,
theme: themeConfig, // optional
deepLinks: deepLinkConfig, // optional
safeArea: SafeAreaConfig.all(),
connector: connectorConfig, // optional — see Connectors
),
);

Android

import com.azeoo.sdk.core.AzeooSDK
import com.azeoo.sdk.core.AzeooConfig

AzeooSDK.initialize(
context = applicationContext,
apiKey = "your-api-key",
config = AzeooConfig(
locale = "en",
analyticsEnabled = true,
offlineEnabled = true,
connectionTimeoutSeconds = 30L,
),
theme = themeConfig, // optional
deepLinks = deepLinkConfig, // optional
safeArea = safeAreaConfig, // optional
connector = connectorConfig, // optional — see Connectors
) { error ->
if (error != null) { /* handle */ return@initialize }
// Ready for connect — use AzeooSDK.shared
}

iOS

import AzeooSDK

let config = AzeooConfig(
locale: "en",
analyticsEnabled: true,
offlineEnabled: true,
connectionTimeoutSeconds: 30,
logLevel: .warning
)

AzeooSDK.initialize(
apiKey: "your-api-key",
config: config,
theme: themeConfig,
deepLinks: deepLinkConfig,
safeArea: safeAreaConfig,
connector: connectorConfig // optional
) { result in
switch result {
case .success:
let sdk = AzeooSDK.shared
// Ready for connectUser
case .failure(let error):
break
}
}

React Native

import { AzeooSDK } from 'react-native-azeoo-lib';

await AzeooSDK.initialize('your-api-key', {
locale: 'en',
analyticsEnabled: true,
offlineEnabled: true,
// theme, deepLinks, safeArea optional
});

Step 2: Connect user

You need a User JWT from your backend and the user's profile fields. See Creating the User JWT for the payload spec, signing instructions, and backend code examples.

Apps Azeoo internes uniquement

Si votre clé API SDK est configurée pour les apps natives internes sur le serveur Azeoo, vous pouvez passer votre token d'auth client existant comme token au lieu d'un JWT utilisateur minté — voir Authentification. La plupart des intégrateurs utilisent le flux JWT standard.

Flutter

await AzeooSDK.connect(
token: userJwt,
gender: 'male', // or your app's gender value
height: Height.scalar(180, HeightUnit.centimeters),
weight: Weight.scalar(75, WeightUnit.kilograms),
);
// userId available: AzeooSDK.userId

Android

AzeooSDK.shared.connectUser(
token = userJwt,
gender = user.gender,
height = user.height, // AzeooHeight
weight = user.weight, // AzeooWeight
) { profile, error ->
if (error != null) return@connectUser
val userId = profile?.id
}

iOS

AzeooSDK.shared.connectUser(
token: userJwt,
gender: user.gender,
height: user.height,
weight: user.weight
) { result in
// profile contains user id
}

React Native

await AzeooSDK.connect(userJwt, gender, heightValue, weightValue);
// See platform doc for measurement shape

See Measurements for height/weight units.


Disconnect

Clears the user session. SDK stays initialized.

PlatformAPI
Flutterawait AzeooSDK.disconnect()
AndroidAzeooSDK.shared.disconnect { }
iOSAzeooSDK.shared.disconnect { }
React Nativeawait AzeooSDK.disconnect()

Next steps