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 ID and token. 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 userId and token 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-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

val sdk = AzeooSDK.init(
context = this,
apiKey = "your-api-key",
config = AzeooConfig(
locale = "en",
analyticsEnabled = true,
offlineEnabled = true,
),
theme = themeConfig, // optional
deepLinks = deepLinkConfig, // optional
safeArea = safeAreaConfig, // optional
)
// Use AzeooSDK.shared or the returned instance

iOS​

import AzeooSDK

AzeooCore.shared.initialize(enableMultipleInstances: false)
let api = AzeooClientApiFromEngine(AzeooCore.shared.getFlutterEngine()!)

api.initialize(
apiKey: "your-api-key",
config: configMessage,
theme: themeMessage,
deepLinks: deepLinkMessage,
safeArea: safeAreaMessage
) { result in
// Handle result
}

React Native​

Use the API provided by the React Native package (e.g. AzeooSDK.init with apiKey, config, and theme). 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 ID and token. Until you connect, module and user APIs are not available.

Flutter​

await AzeooSDK.connect(userId, token);
// Then use AzeooSDK.nutrition, AzeooSDK.training, AzeooSDK.user, etc.

Android​

AzeooSDK.shared.connect(userId = "user-123", token = "jwt-token") { result ->
result.onSuccess { profile -> /* SDK ready */ }
result.onFailure { error -> /* Handle error */ }
}

iOS​

api.connect(userId: "user-123", token: "jwt-token") { result in
switch result {
case .success(let profile): break // SDK ready
case .failure(let error): break // Handle error
}
}

Step 3: Use the SDK​

Once connected, use the SDK instance to embed modules or open screens:

  • Flutter: AzeooSDK.nutrition.showMainScreen(), AzeooSDK.training.showWorkouts(), or embed AzeooSDKContent.
  • Android: AzeooSDK.shared.modules.nutrition.getFragment(), .showDiary(), etc.
  • iOS: Get the SDK instance and use modules.nutrition.getViewController(), showDiary(), etc.
  • React Native: Use the package's module views and methods as documented.

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​