appsflyer-flutter-plugin

AppsFlyer Logo

pub package Coverage

Flutter plugin for the AppsFlyer mobile attribution and analytics SDK on Android and iOS.

🛠 In order for us to provide optimal support, please contact AppsFlyer support through the Customer Assistant Chatbot for assistance with troubleshooting issues or product guidance.
To do so, please follow this article

SDK Versions

This plugin release bundles:

Platform RPC layer the plugin pins AppsFlyer SDK it resolves to
Android af-android-plugin-bridge v7.0.13 v7.0.4
iOS AppsFlyerRPC v7.0.41 v7.0.4

The Android SDK version is set by af-android-sdk-bom v7.0.4, imported as a Gradle platform. It governs af-android-sdk and af-android-sdk-base, not the RPC bridge or the Purchase Connector — the plugin pins those itself.

Since v7.0.0 the plugin integrates through the AppsFlyer RPC layer instead of depending on the native SDK directly. The plugin decides the Android SDK version — do not override it. Do not pin com.appsflyer:af-android-sdk, and do not import your own af-android-sdk-bom: the plugin, the RPC bridge and the native SDK are released and tested as one set, and any other combination is unsupported. To move the Android SDK, upgrade the plugin.

Forcing the versions anyway (enforcedPlatform, resolutionStrategy.force) does not work either — the plugin pins its RPC bridge with strictly, so such a build fails instead of shipping a mismatched RPC layer.

On iOS the podspec pins AppsFlyerFramework to the version AppsFlyerRPC and PurchaseConnector require; do not override it.

Purchase Connector versions

When Purchase Connector is enabled in your app:

  • Android 2.2.0
  • iOS 7.0.4

❗❗ Breaking changes when updating to v7.x.x ❗❗

The public Flutter API changed in this major release. For the native SDK versions this release resolves to, see SDK Versions above.

  • Minimum supported versions: Flutter 3.35.0, Dart 3.9.0 (and earlier than 4.0.0), Android API 21, and iOS 13.0. On Android the plugin also requires Kotlin Gradle Plugin 2.0.21, Android Gradle Plugin 8.9.1, Gradle 8.11.1 and JDK 17, matching the AppsFlyer Android SDK. Flutter 3.35 templates all of them — see doc/installation-guide.md.

Use AppsFlyerSdk.instance, call init(devKey:, appId:) (appId is required on iOS and optional on Android), register the listeners you need with their callbacks, and call start() from the session-ready callback:

final appsflyerSdk = AppsFlyerSdk.instance;

// If your app handles deep links, register before init(). Android decides once
// per install, while init() processes the launch intent, whether to request the
// deferred deep link — registering later skips it for that install permanently.
await appsflyerSdk.registerDeepLinkListener(onDeepLinking: (result) {
  print('Deep link: ${result.deepLink?.deepLinkValue}');
});

await appsflyerSdk.init(
  devKey: '<DEV_KEY>',
  appId: '<APP_ID>',
);
await appsflyerSdk.registerSessionReadyListener(() async {
  await appsflyerSdk.start();
});

All removed APIs, renamed APIs, lifecycle changes, and upgrade instructions are documented in doc/migration-guide.md.

AD_ID permission for Android

In v6.8.0 of the AppsFlyer SDK, we added the normal permission com.google.android.gms.permission.AD_ID to the SDK's AndroidManifest, to allow the SDK to collect the Android Advertising ID on apps targeting API 33. If your app is targeting children, you need to revoke this permission to comply with Google's Data policy. You can read more about it in the Android SDK installation guide.

📖 Guides

Libraries

appsflyer_sdk
The public API for the AppsFlyer SDK 7 Flutter plugin.