Unity
Install Unity SDK to validate user receipts, get in-app subscription analytics, and 3-rd party integrations.
Install via OpenUPM
Qonversion SDK package is available on the openupm registry. You can install it via openupm-cli.
openupm add com.qonversion.unity
Install via Git URL
Available starting from Unity 2018.3.
Just add this line to the Packages/manifest.json file of your Unity Project:
"dependencies": {
"com.qonversion.unity": "https://github.com/qonversion/unity-sdk.git#7.0.0"
}
Install Native Dependencies
Attention
Make sure your project contains the External Dependencies Manager package. Otherwise, iOS & Android dependencies can be unresolved. This can result in a package import issue. Here are the steps to solve this issue:
- Download the last version of the External Dependencies Manager package.
- In the Unity Editor click Import package -> Custom package
- Choose a file with the
.unitypackage
dependency from the folder you've downloaded before and install it.
IOS
- Switch your Unity project to iOS.
1.1 In the Unity select File -> Build Settings.
1.2 Select iOS from the menu on the left and click Switch platform (will be available if the current platform is not iOS). If the platform selected is iOS already, you can go ahead with the next step. - In the Unity select Assets -> External Dependency Manager -> iOS Resolver -> Install Cocoapods
- Upload your project to a separate folder.
3.1 In Unity choose File -> Build settings.
3.2 Select iOS from the menu on the left, then click the Build button.
3.3 Select the folder where the iOS project will be saved. - Navigate to your iOS project folder in the terminal and run the
pod install
command. - Run the project by selecting the file with the
.xcworkspace
extension.
Android
- Switch your Unity project to Android.
1.1 In Unity, select File -> Build Settings.
1.2 Select Android from the menu on the left and click Switch platform (will be available if the current platform is not Android). If the platform selected is Android already, you can go ahead with the next step. - In Unity select Assets -> External Dependency Manager -> Android Resolver -> Resolve
- Upload your project to a separate folder.
3.1 In Unity choose File -> Build settings.
3.2 Select Android from the menu on the left.
3.3 Set Export project checkbox.
3.4 Click the Export button and select the folder where the Android project will be saved. - Open your Android project in Android Studio (or any other IDE you like).
- Enable multidex for your app (if the
minSdkVersion
property is set to 20 or lower)
5.1 Select thebuild.gradle
file from the launcher module.
5.2 Delete the following line at the top of the file:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
5.3 Enable multidex and add the multidex library as a dependency in the abovebuild.gradle
file
5.4 In Android Studio select File -> Sync Project with Gradle Files (or the equivalent for your IDE).
defaultConfig {
...
multiDexEnabled true
}
...
}
dependencies {
...
implementation "androidx.multidex:multidex:2.0.1"
}
Settings for Analytics Mode (Android only)
Duplicated BillingClient classes
If you already have your in-app subscription implementation that uses Google Play Billing Library, you may get a compilation error about duplicate BillingClient classes. To get rid of the error, you can exclude the
billingclient
dependency, which distributes with the Qonversion SDK, following the guide below:
- In the Unity Editor open the Player Settings window: File -> Build Settings -> Player Settings for Android.
- Choose Publishing Settings -> Gradle.
- Enable the checkboxes for
Custom Main Gradle Template
andCustom Gradle Properties Template
.
- It will generate a
mainTemplate.gradle
file in theAssets/Plugins/Android/
folder. Add the following strings to the dependencies block of the file:
dependencies {
...
configurations.all {
exclude group: 'com.android.billingclient', module: 'billing'
}
}
- Delete resolved dependencies:
Assets -> External Dependency Manager -> Android Resolver -> Delete Resolved Libraries
and thenResolve
. - Make sure that the Android Resolver added qonversion-sdk to the dependencies list in the
build.gradle
file for theunityLibrary
module:
Kids Mode for Qonversion Unity SDK
In case you are building an App for Kids, please, follow this guide to learn more about Kids Mode for Qonversion SDKs.
Updated 3 months ago