Перейти к содержимому

Configuration

Это содержимое пока не доступно на вашем языке.

This page walks through adding the Affise Unity package to your project, performing any native platform configuration, and initializing the SDK.

From the README verbatim:

Open Package Manager (Window / Package Manager)

Add package from git url https://github.com/affise/affise-mmp-sdk-unity.git

Alternate install via a downloaded .unitypackage:

Download latest Affise SDK attribution-1.7.18.unitypackage from the releases page and drop this file into the Unity editor.

The package manifest identifier is com.affise.attribution at version 1.7.18 (package.json:2-3).

After import the SDK expects either:

  1. An Affise Settings.asset created via Edit / Project Settings / Affise → Create button, placed under Assets/Affise/Resources/, or
  2. A manual Affise.Settings(...).Start() initialization in code.

The Unity package ships post-build processors that wire up the native Android and iOS plugins.

The bundled Android library lives at Runtime/Plugins/unity.androidlib/ (Runtime/Plugins/unity.androidlib/build.gradle:1). Its manifest at Runtime/Plugins/unity.androidlib/src/main/AndroidManifest.xml:1-3 declares package com.affise.attribution.unity and no permissions.

Gradle configuration for the Android library:

apply plugin: 'com.android.library'
android {
namespace "com.affise.attribution.unity"
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
targetSdkVersion 30
}
}
final affise_version = "1.7.18"
dependencies {
implementation "com.android.installreferrer:installreferrer:2.2"
// Affise SDK
implementation "com.affise:internal:$affise_version"
}

Build hooks:

  • Android post-processor: Editor/Build/Modules/ModulesAndroidPostProcessBuild.cs:10 (implements IPostGenerateGradleAndroidProject).
  • Android deeplink preprocessor: Editor/Build/Deeplink/DeeplinkAndroidBuild.cs:16 (implements IPreprocessBuildWithReport).

The post-build processors add these dependencies to the generated native projects. README shows them for reference only: “All affise modules is updated automatically on build” and “No manual editing is required” (README.md:272-276, README.md:320-324). The editor’s module list and default versions come from Editor/Resources/AffiseModules.json.

Android project build.gradle (README.md:296-316):

final affise_version = '1.7.18'
dependencies {
// ...
// Affise modules
implementation "com.affise:module-advertising:$affise_version"
implementation "com.affise:module-androidid:$affise_version"
implementation "com.affise:module-hardware:$affise_version"
implementation "com.affise:module-link:$affise_version"
implementation "com.affise:module-network:$affise_version"
implementation "com.affise:module-phone:$affise_version"
implementation "com.affise:module-status:$affise_version"
implementation "com.affise:module-subscription:$affise_version"
implementation "com.affise:module-meta:$affise_version"
implementation "com.affise:module-rustore:$affise_version"
implementation "com.affise:module-huawei:$affise_version"
implementation "com.affise:module-appsflyer:$affise_version"
implementation "com.affise:module-tiktok:$affise_version"
}

Initialize by calling Affise.Settings(affiseAppId, secretKey).Start() (Runtime/Affise.cs:39, Runtime/Settings/AffiseSettings.cs:172):

Affise
.Settings(
affiseAppId: "Your appId", //Change to your app id
secretKey: "Your SDK secretKey" //Change to your SDK secretKey
)
.Start(); // Start Affise SDK