initAppsFlyer method

Future<void> initAppsFlyer()

Initializes AppsFlyer SDK with the dev key from config. Sets the device UUID as the custom user ID.

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);
  await _appsflyerSdk!.initSdk(
    registerConversionDataCallback: false,
    registerOnAppOpenAttributionCallback: false,
    registerOnDeepLinkingCallback: false,
  );

  _appsflyerId = await _appsflyerSdk!.getAppsFlyerUID();

  if (config.debugMode) {
    debugPrint('NanoafService: AppsFlyer initialized, uid=$_appsflyerId');
  }
}