initAppsFlyer method
Implementation
Future<void> initAppsFlyer() async {
final deviceId = await _getOrCreateDeviceId();
final options = AppsFlyerOptions(
afDevKey: config.appsFlyerDevKey,
appId: config.appsFlyerAppId,
showDebug: config.debugMode,
);
_appsflyerSdk = AppsflyerSdk(options);
_appsflyerSdk!.setCustomerUserId(deviceId);
_appsflyerSdk!.onInstallConversionData((data) {
if (config.debugMode) {
debugPrint('AfHelperService: conversion data received: $data');
}
_conversionData = data is Map<String, dynamic>
? data
: (data is Map ? Map<String, dynamic>.from(data) : null);
if (!_conversionDataCompleter.isCompleted) {
_conversionDataCompleter.complete(_conversionData);
}
});
await _appsflyerSdk!.initSdk(
registerConversionDataCallback: true,
registerOnAppOpenAttributionCallback: false,
registerOnDeepLinkingCallback: false,
);
_appsflyerId = await _appsflyerSdk!.getAppsFlyerUID();
if (config.debugMode) {
debugPrint('AfHelperService: AppsFlyer initialized, uid=$_appsflyerId');
}
}