SDK Initialization
The Azeoo SDK uses a single, two-step flow on all platforms: initialize with your API key and options, then connect with a user token and profile fields required by the SDK (gender, height, weight). The steps below apply to Android, iOS, Flutter, and React Native; for full setup (dependency, Application/AppDelegate, etc.), see Quick Start and your platform's installation guide.
Initialization flowβ
- Initialize β Pass API key and optional config (locale, theme, safe area, deep links, analytics, offline). No user is attached.
- Connect β Pass a user token and required profile fields (gender, height, weight) to attach a user. After this, you can use modules and user/theme/navigation APIs.
Step 1: Initializeβ
Flutterβ
import 'package:azeoo_sdk/azeoo_sdk.dart';
await AzeooSDK.initialize(
'your-sdk-api-key',
options: AzeooSDKInitOptions(
locale: 'en',
analyticsEnabled: true,
offlineSupport: true,
theme: themeConfig,
deepLinks: deepLinkConfig,
safeArea: SafeAreaConfig.all(),
),
);
Androidβ
import com.azeoo.sdk.AzeooSDK
import com.azeoo.sdk.AzeooConfig
AzeooSDK.initialize(
context = this,
apiKey = "your-sdk-api-key",
config = AzeooConfig(
locale = "en",
analyticsEnabled = true,
offlineEnabled = true,
),
theme = themeConfig, // optional
deepLinks = deepLinkConfig, // optional
safeArea = safeAreaConfig, // optional
callback = { error ->
if (error == null) {
// SDK initialized: use `AzeooSDK.shared`
} else {
// Handle initialization error
}
}
)
iOSβ
import AzeooSDK
AzeooSDK.initialize(
apiKey: "your-sdk-api-key",
config: configMessage,
theme: themeMessage,
deepLinks: deepLinkMessage,
safeArea: safeAreaMessage
) { result in
switch result {
case .success(let sdk):
// Keep `sdk` or use `AzeooSDK.shared`
break
case .failure(let error):
// Handle error
break
}
}
React Nativeβ
import { AzeooProvider } from 'react-native-azeoo-lib';
<AzeooProvider
apiKey={API_KEY}
config={{ locale: 'en', analyticsEnabled: true, offlineEnabled: true }}
theme={{ isDarkMode: false, colors: { primary: '#007AFF' } }}
autoInitialize={true}
>
<YourApp />
</AzeooProvider>
See the React Native installation and quick start for the exact API.
Step 2: Connect userβ
After initialize, call connect with the authenticated user's token and required profile fields (gender, height, weight). Until you connect, module and user APIs are not available.
Flutterβ
await AzeooSDK.connect(
token: userToken,
gender: 'male',
height: Height(170),
weight: Weight(70),
);
// Then use `AzeooSDKModules.nutrition`
Androidβ
AzeooSDK.shared.connectUser(
token = "user-token",
gender = "male",
height = AzeooHeight(170.0),
weight = AzeooWeight(70.0),
) { profile, error ->
if (error != null) {
// Handle error
} else {
// SDK ready
}
}
iOSβ
sdk.connectUser(
token: "user-token",
gender: "male",
height: userHeight,
weight: userWeight
) { result in
switch result {
case .success(let profile): break // SDK ready
case .failure(let error): break // Handle error
}
}
React Nativeβ
const { connect } = useAzeoo();
await connect(token, userData.gender, userData.height, userData.weight);
Step 3: Use the SDKβ
Once connected, use the SDK instance to embed modules or open screens:
- Flutter:
AzeooSDKModules.nutrition.showMainScreen(bottomSafeArea: false)or embedAzeooSDKContent(bottomSafeArea: false). - Android:
AzeooSDK.shared.modules.nutrition.getFragment(bottomSafeArea = false). - iOS: use
sdk.modules.nutrition.getView()/getViewController()and trigger rendering withsdk.modules.nutrition.display { _ in }. - React Native: embed
NutritionView(or open the module via the SDK methods shown in the React Native example).
See your platform's SDK API / Client section for the full list of methods.
Error handlingβ
Always handle errors from initialize and connect (e.g. invalid API key, network issues, invalid token). Do not assume the SDK is ready until these calls succeed.
Next stepsβ
- Authentication β How auth fits with connect
- Android Configuration
- iOS Configuration
- Flutter Configuration
- React Native Configuration