initializeSDK static method
Future<void>
initializeSDK({
- required String licenseKey,
- required String iOSContainerID,
- String? storageFolderName = "Mirrorfly Flutter",
- bool chatHistoryEnable = false,
- bool enableMobileNumberLogin = true,
- bool enableDebugLog = false,
- bool enablePrivateStorage = false,
- @Deprecated("Instead of use Mirrorfly.configureAndroidCallKit()") bool? enableAndroidCallKitUI = true,
- required dynamic flyCallback(
- FlyResponse response
Initializes the SDK with the provided configuration parameters.
This method initializes the Mirrorfly SDK with the specified configuration parameters.
It is an asynchronous operation that returns a Future that completes with void
once the initialization is complete.
Parameters:
licenseKey
: The license key used for SDK initialization. Must not be null.iOSContainerID
: The iOSContainerID represents App Group ID for iOS app sharing data between app extensions and containing apps. Must not be null for iOS.storageFolderName
: The name of the storage folder to be used by the SDK. Defaults to "Mirrorfly".chatHistoryEnable
: Flag indicating whether chat history should be enabled. Defaults to false.enableMobileNumberLogin
: Flag indicating whether mobile number login should be enabled. Defaults to true.enableDebugLog
: Flag indicating whether debug logs should be enabled. Defaults to false.enablePrivateStorage
: Flag indicating whether private storage should be enable. Defaults to false.enableAndroidCallKitUI
: Flag indicating whether default android incoming callKit ui is enabled. Defaults to true. Note: TheenableAndroidCallKitUI
parameter inMirrorfly.initializeSDK()
has been deprecated. To control the native ringtone and incoming call UI behavior, use:Mirrorfly.configureAndroidCallKit(enableRingtone: true,enableIncomingCallUI: true)flyCallback
: A callback function to handle the response from the SDK initialization. Must not be null.
Returns:
A Future that completes with void
once the initialization is complete.
Throws:
- PlatformException if any of the required parameters are null or other exceptions.
Example usage:
await Mirrorfly.initializeSDK(
licenseKey: "your_license_key",
iOSAppGroupID: "your_app_group_id",
flyCallback: (response) {
if (response.isSuccess) {
print('SDK initialization successful');
} else {
print('SDK initialization failed: ${response.errorMessage}');
}
runApp(const MyApp());
},
);
Implementation
static Future<void> initializeSDK(
{required String licenseKey,
required String iOSContainerID,
String? storageFolderName = "Mirrorfly Flutter",
bool chatHistoryEnable = false,
bool enableMobileNumberLogin = true,
bool enableDebugLog = false,
bool enablePrivateStorage = false,
@Deprecated("Instead of use Mirrorfly.configureAndroidCallKit()")
bool? enableAndroidCallKitUI = true,
required Function(FlyResponse response) flyCallback}) {
var builder = InitializeSDKBuilder(
iOSContainerID: iOSContainerID,
licenseKey: licenseKey,
storageFolderName: storageFolderName,
chatHistoryEnable: chatHistoryEnable,
enableMobileNumberLogin: enableMobileNumberLogin,
enableDebugLog: enableDebugLog,
enablePrivateStorage: enablePrivateStorage,
enableAndroidCallKitUI: enableAndroidCallKitUI);
isChatHistoryEnabled = chatHistoryEnable;
isPrivateStorageEnabled = enablePrivateStorage;
return FlyChatFlutterPlatform.instance.initializeSDK(builder, flyCallback);
}