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β
- Initialize β Pass API key and optional config (locale, theme, safe area, deep links, analytics, offline). No user is attached.
- Connect β Pass
userIdandtokento 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 embedAzeooSDKContent. - 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β
- Authentication β How auth fits with connect
- Android Configuration
- iOS Configuration
- Flutter Configuration
- React Native Configuration