configure method

Future<void> configure({
  1. required String apiKey,
  2. String? baseUrl,
  3. RovenueLogLevel logLevel = RovenueLogLevel.warn,
  4. String? appVersion,
  5. String? environment,
  6. bool awaitMmpAttribution = false,
  7. String? facebookAppId,
  8. bool automaticStoreMessages = true,
})

Initialize the SDK. Must be called before any other method here — everything else assumes a configured native core and crashes (fatalError on iOS, IllegalStateException on Android) otherwise. Calling it again replaces the underlying native instance (the equivalent of calling shutdown first). appVersion is optional; when omitted, the native layer auto-reads the host app's version and getAppVersion reports back whatever was actually resolved.

awaitMmpAttribution holds the first placement request after install (up to 3 s) until setAttribution has been called with your MMP's callback, so the first onboarding can be targeted by the MMP's campaign data. facebookAppId is Android only: the Facebook App ID for Meta's install referrer, defaulting to the com.facebook.sdk.ApplicationId manifest meta-data your app already carries; iOS ignores it.

automaticStoreMessages (iOS only, default true) leaves App Store messages — billing issue, price increase consent, win-back offer — to StoreKit, which shows each one when the app comes to the foreground; false holds them until you call showStoreMessages.

A Sandbox (rov_pk_test_…) key in a release build (kReleaseMode) throws RovenueException with RovenueErrorKind.sandboxKeyInRelease: a test key must never ship to the stores. Use a Production (rov_pk_live_…) key in release builds.

Implementation

Future<void> configure({
  required String apiKey,
  String? baseUrl,
  RovenueLogLevel logLevel = RovenueLogLevel.warn,
  String? appVersion,
  String? environment,
  bool awaitMmpAttribution = false,
  String? facebookAppId,
  bool automaticStoreMessages = true,
}) =>
    _platform.configure(
      apiKey: apiKey,
      baseUrl: baseUrl,
      logLevel: logLevel,
      appVersion: appVersion,
      environment: environment,
      releaseBuild: kReleaseMode,
      awaitMmpAttribution: awaitMmpAttribution,
      facebookAppId: facebookAppId,
      automaticStoreMessages: automaticStoreMessages,
    );