Skip to content

Latest commit

Β 

History

1,171 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

appsflyer-unity-plugin

License: MIT GitHub tag RC Release Pipeline check packages

πŸ›  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

πŸ“– The Unity documentation also be found here

  • Android AppsFlyer SDK v7.0.1
  • Android Purchase Connector 2.3.0
  • iOS AppsFlyer SDK v7.0.2
  • iOS Purchase Connector 7.0.2

πŸ“Œ RPC-schema-aligned plugin core + new async API surface

The plugin's C#/native bridge was migrated to a JSON-RPC transport (Assets/AppsFlyer/appsflyer-plugins-rpc-schema.json), replacing the legacy per-method AndroidJavaClass/DllImport bridge. Alongside this, getters that need a return value (e.g. getAppsFlyerUID, getSdkVersion, isSessionReady) are async Awaitable<T> too, matching the pattern already used by generateInviteLink, so none of them need to block Unity's main thread for the native round trip. iOS deep-link delivery (cold-start URL schemes and Universal Links) was also reworked β€” see docs/adr/0001-ios-deep-link-delivery-architecture.md for the delivery-path rationale.


The RPC bridge migration (see above) renames several core APIs and makes most of the public surface async Awaitable/Awaitable<T>. There is no backward-compatible alias for the renamed methods β€” update call sites when you upgrade.

Old (synchronous) New (async Awaitable)
AppsFlyer.initSDK(devKey, appID, gameObject) await AppsFlyer.init(devKey, appID, gameObject)
AppsFlyer.startSDK() await AppsFlyer.start()
AppsFlyer.stopSDK(bool) await AppsFlyer.stop(bool)
AppsFlyer.isSDKStopped() await AppsFlyer.isStopped()
AppsFlyer.getAppsFlyerId() await AppsFlyer.getAppsFlyerUID()

Breaking: starting with 7.0.x, the AppsFlyerObject.prefab UI-based setup has been removed. Initialize the SDK manually instead β€” see Manual integration.

New: a session-ready listener API β€” AppsFlyer.OnSessionReady, registerSessionReadyListener(), unregisterSessionReadyListener(), isSessionReady() β€” lets you defer start() until the native SDK reports session readiness instead of calling it unconditionally right after init(). See Session Ready Listener and the API reference.

Requirements: Unity 2023.1+ (see below) and EDM4U 1.2.187 or newer β€” earlier 1.2.x releases mis-resolve the new iOS Swift Package Manager dependency (AppsFlyerRPC). See Installation.


πŸ“Œ Minimum supported Unity version raised to 2023.1

Starting from this release, the plugin requires Unity 2023.1 or newer (raised from 2019.4). This is required for Awaitable/Awaitable<T> support, used by the new async APIs (e.g. generateInviteLink, getAppsFlyerUID). If you're on an older Unity version, stay on the last plugin release that supported Unity 2019.4.


πŸ“Œ Google Play Billing Library 8 (6.18.0+)

From v6.18.0 onward, the Unity plugin ships as a single release line with Google Play Billing Library 8.0.0 on Android (Purchase Connector included in the main package). There is no separate v7 plugin variant for new 6.18.x releases.

  • Unity IAP: Use Unity IAP (com.unity.purchasing) 5.0.0 or newer (recommended: latest 5.x). Unity IAP 4.x does not include Billing v8.
  • Migration: Apps still on Billing v7 must migrate to Billing v8 APIs before upgrading to 6.18.0+.

Still on Billing Library v7?

Use the last 6.17.x dual-line release: v6.17.90 (Billing v7) or v6.17.91 (Billing v8). See Installation for Maven wrapper coordinates on 6.17.x.


  • Starting from version 6.17.1, the Purchase Connector is now integrated directly into the main AppsFlyer Unity plugin. You no longer need to download, import, or maintain a separate Purchase Connector package.
  • If you were previously using the standalone Purchase Connector from a separate repository, simply remove any references to using AppsFlyerConnector; from your codebase, as its functionality is now included in the main plugin under the AppsFlyerSDK namespace.
  • The Purchase Connector now supports StoreKit 2 for iOS 15+ alongside the existing StoreKit 1 support.
  • For detailed migration instructions and new features, see our Purchase Connector documentation.
  • Android + AGP 8: com.appsflyer:purchase-connector:2.3.0 and com.appsflyer:af-android-sdk:7.0.1 currently share the same manifest package (com.appsflyer), which AGP 8's mandatory namespace-uniqueness check hard-fails on. There is no known consumer-side Gradle property that resolves this (in particular, android.uniquePackageNames is an older, unrelated flag and does not fix it) β€” the fix has to happen upstream, in how these artifacts are published. Until that lands, purchase-connector cannot be built alongside af-android-sdk under AGP 8+; track the upstream issue with AppsFlyer support for status.

  • In-App Purchase Validation API Changes: The validateAndSendInAppPurchase method signatures have been updated for better type safety and cleaner code.
  • V2 Methods (Recommended): New overloads using structured data classes (AFPurchaseDetailsAndroid/AFSDKPurchaseDetailsIOS) are now the recommended approach.
  • Legacy Methods (Deprecated): The old string-based parameter methods are now deprecated but maintained for backward compatibility.
  • Migration Required: If you're using the old validateAndSendInAppPurchase methods, consider migrating to the V2 versions for better maintainability.
  • For detailed API documentation and migration examples, see our API reference.

  • Starting from version 6.12.20, we have changed the way we distribute the plugin via UPM. The UPM branches will no longer hold a dependency for com.google.external-dependency-manager as it was proved to cause issues in different versions of Unity - to be clear, this dependency is still required to utilize our plugin, we just can't distribute the plugin with it in UPM form as the EDM4U dependency is not available via UPM for quite a while already but is still available via .unitypackage or .tgz files, if you use UPM to fetch our plugin - please download a suitable version of EDM4U so you will be able to resolve the dependencies, or opt for an installation without EDM4U.

  • Starting version 6.6.0, there is no more need to differentiate between iOS and Android APIs. All APIs must be called with AppsFlyer class (even if the API is only iOS or Android).
  • Please take into consideration that since version 6.6.0, most of the APIs require initSDK to be called prior to using them, and since version 6.10.10 only a handful of APIs will properly work when called prior to initialization: setIsDebug, setCurrencyCode, setHost, disableSKAdNetwork.

Example:

Before 6.6.0:

#if UNITY_IOS && !UNITY_EDITOR
    AppsFlyeriOS.waitForATTUserAuthorizationWithTimeoutInterval(60);
#endif

After 6.6.0:

#if UNITY_IOS && !UNITY_EDITOR
    AppsFlyer.waitForATTUserAuthorizationWithTimeoutInterval(60);
#endif

The plugin supports a Strict Mode which completely removes the IDFA collection functionality and AdSupport framework dependencies. Use the Strict Mode when developing apps for kids, for example. More information about how to install the Strict Mode is available here.

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 here.



About

AppsFlyer Unity Plugin

Topics

Resources

Stars

178 stars

Watchers

14 watching

Forks

Releases

Packages

Used by

Contributors

Languages