Skip to main content

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​

  1. Initialize β€” Pass API key and optional config (locale, theme, safe area, deep links, analytics, offline). No user is attached.
  2. 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 embed AzeooSDKContent(bottomSafeArea: false).
  • Android: AzeooSDK.shared.modules.nutrition.getFragment(bottomSafeArea = false).
  • iOS: use sdk.modules.nutrition.getView() / getViewController() and trigger rendering with sdk.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​