Skip to main content

Legacy installation guide

Adapty comprises two crucial SDKs for seamless integration into your mobile app:

  • Core AdaptySDK: This is a fundamental, mandatory SDK necessary for the proper functioning of Adapty within your app.
  • AdaptyUI SDK: This optional SDK becomes necessary if you use the Adapty Paywall Builder: a user-friendly, no-code tool for easily creating cross-platform paywalls. These paywalls are built in a visual constructor right in our dashboard, run entirely natively on the device, and require minimal effort from you to create something that performs well.

Please consult the compatibility table below to choose the correct pair of Adapty SDK and AdaptyUI SDK.

AdaptySDK-Unity versionAdaptyUI-Unity version
2.7.12.0.1
2.9.0not compatible
danger

Go through release checklist before releasing your app

Before releasing your application, make sure to carefully review the Release Checklist thoroughly. This checklist ensures that you've completed all necessary steps and provides criteria for evaluating the success of your integration.

Install Adapty SDKs

To install the Adapty SDKs:

  1. Download the adapty-unity-plugin-*.unitypackage from GitHub and import it into your project.
  1. Download the adapty-ui-unity-plugin-*.unitypackage from GitHub and import it into your project.
  1. Download and import the External Dependency Manager plugin.

  2. The SDK uses the "External Dependency Manager" plugin to handle iOS Cocoapods dependencies and Android gradle dependencies. After the installation, you may need to invoke the dependency manager:

    Assets -> External Dependency Manager -> Android Resolver -> Force Resolve

    and

    Assets -> External Dependency Manager -> iOS Resolver -> Install Cocoapods

  3. When building your Unity project for iOS, you would get Unity-iPhone.xcworkspace file, which you have to open instead of Unity-iPhone.xcodeproj, otherwise, Cocoapods dependencies won't be used.

Configure Adapty SDK

To configure the Adapty SDK for Unity, start by initializing the Adapty Unity Plugin and then using it as described in the guidance below. Additionally, ensure to set up your logging system to receive errors and other important information from Adapty.

Activate Adapty SDK

You only need to activate the Adapty SDK once, typically early in your app's lifecycle.

using AdaptySDK;

var builder = new AdaptyConfiguration.Builder("YOUR_API_KEY")
.SetCustomerUserId(null)
.SetObserverMode(false)
.SetServerCluster(AdaptyServerCluster.Default)
.SetIPAddressCollectionDisabled(false)
.SetIDFACollectionDisabled(false);
.SetActivateUI(true)
.SetAdaptyUIMediaCache(
100 * 1024 * 1024, // MemoryStorageTotalCostLimit 100MB
null, // MemoryStorageCountLimit
100 * 1024 * 1024 // DiskStorageSizeLimit 100MB
);

Adapty.Activate(builder.Build(), (error) => {
if (error != null) {
// handle the error
return;
}
});
ParameterPresenceDescription
apiKeyrequiredThe key you can find in the Public SDK key field of your app settings in Adapty: App settings-> General tab -> API keys subsection
logLeveloptionalAdapty logs errors and other crucial information to provide insight into your app's functionality. There are the following available levels:
  • error: Only errors will be logged.
  • warn: Errors and messages from the SDK that do not cause critical errors, but are worth paying attention to will be logged.
  • info: Errors, warnings, and serious information messages, such as those that log the lifecycle of various modules will be logged.
  • verbose: Any additional information that may be useful during debugging, such as function calls, API queries, etc. will be logged.
observerModeoptional

A boolean value controlling Observer mode. Turn it on if you handle purchases and subscription status yourself and use Adapty for sending subscription events and analytics.

The default value is false.

🚧 When running in Observer mode, Adapty SDK won't close any transactions, so make sure you're handling it.

customerUserIdoptionalAn identifier of the user in your system. We send it in subscription and analytical events, to attribute events to the right profile. You can also find customers by customerUserId in the Profiles and Segments menu.
idfaCollectionDisabledoptional

Set to true to disable IDFA collection and sharing.

The default value is false.

For more details on IDFA collection, refer to the Analytics integration section.

ipAddressCollectionDisabledoptional

Set to true to disable user IP address collection and sharing.

The default value is false.

Use Adapty Unity Plugin

  1. Create a script to listen to Adapty events. Name it AdaptyListener in your scene. We suggest using the DontDestroyOnLoad method for this object to ensure it persists throughout the application's lifespan.

Adapty uses AdaptySDK namespace. At the top of your script files that use the Adapty SDK, you may add

C#
using AdaptySDK;
  1. Subscribe to Adapty events:
C#
   using UnityEngine;
using AdaptySDK;

public class AdaptyListener : MonoBehaviour, AdaptyEventListener {
void Start() {
DontDestroyOnLoad(this.gameObject);
Adapty.SetEventListener(this);
}

public void OnLoadLatestProfile(Adapty.Profile profile) {
// handle updated profile data
}
}

Please keep in mind that for paywalls and products to be displayed in your mobile application, and for analytics to work, you need to display the paywalls and, if you're using paywalls not created with the Paywall Builder, handle the purchase process within your app.