Configuration
Это содержимое пока не доступно на вашем языке.
1. Add the dependency
Section titled “1. Add the dependency”Add affise_attribution_lib to your pubspec.yaml:
dependencies: affise_attribution_lib: ^1.7.18Or run flutter pub add affise_attribution_lib.
Alternatively, use a Git dependency:
dependencies: affise_attribution_lib: git: url: https://github.com/affise/affise-mmp-sdk-flutter path: affise_attribution_libpath: affise_attribution_lib is required: since 1.7.14/1.7.15 the plugin lives in the affise_attribution_lib/ subdirectory of the repository.
Optional module packages
Section titled “Optional module packages”Since 1.7.14/1.7.15 every native Affise module is also published as a Flutter wrapper package. This is the recommended installation option. Add only the ones you need (each module page lists its package):
dependencies: affise_attribution_lib: ^1.7.18 affise_attribution_module_adservice: ^1.7.18 affise_attribution_module_advertising: ^1.7.18 affise_attribution_module_androidid: ^1.7.18 affise_attribution_module_appsflyer: ^1.7.18 affise_attribution_module_google: ^1.7.18 affise_attribution_module_huawei: ^1.7.18 affise_attribution_module_link: ^1.7.18 affise_attribution_module_meta: ^1.7.18 affise_attribution_module_network: ^1.7.18 affise_attribution_module_persistent: ^1.7.18 affise_attribution_module_phone: ^1.7.18 affise_attribution_module_rustore: ^1.7.18 affise_attribution_module_status: ^1.7.18 affise_attribution_module_subscription: ^1.7.18 affise_attribution_module_tiktok: ^1.7.18The packages have no Dart API — they only add the native module dependency (com.affise:module-* on Android, AffiseModule/* on iOS).
Native module dependencies (alternative)
Section titled “Native module dependencies (alternative)”You can also add the native modules to android/app/build.gradle / ios/Podfile manually, as described on each module page. The README recommends the Flutter packages above instead.
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" // ...}Available Android modules: ADVERTISING, ANDROIDID, APPSFLYER, HARDWARE, LINK, NETWORK, PHONE, STATUS, SUBSCRIPTION, RUSTORE, HUAWEI, META, TIKTOK.
target 'Runner' do # ... affise_version = '1.7.18' # All Affise Modules pod 'AffiseModule', affise_version # Or only specific Modules pod 'AffiseModule/AdService', affise_version pod 'AffiseModule/Advertising', affise_version pod 'AffiseModule/Hardware', affise_version pod 'AffiseModule/Link', affise_version pod 'AffiseModule/Persistent', affise_version pod 'AffiseModule/Status', affise_version # ...endAvailable iOS modules: ADSERVICE, ADVERTISING, APPSFLYER, GOOGLE, HARDWARE, LINK, PERSISTENT, STATUS, SUBSCRIPTION, TIKTOK.
HARDWARE (new in native 1.7.18) has no Flutter wrapper package — it can only be added natively. See Hardware module.
2. Fetch packages
Section titled “2. Fetch packages”flutter pub get3. Platform configuration
Section titled “3. Platform configuration”Add the INTERNET permission to your AndroidManifest.xml:
<manifest> <uses-permission android:name="android.permission.INTERNET"/></manifest>Add NSUserTrackingUsageDescription to your Info.plist. It is required for the AppTrackingTransparency framework’s advertisingIdentifier, and the app will crash if the key is missing when the Advertising module is active.
<plist version="1.0"><dict> ... <key>NSUserTrackingUsageDescription</key> <string>Youre permission text</string></dict>4. Initialize the plugin
Section titled “4. Initialize the plugin”Call Affise.settings(...) inside your State.initState:
import 'package:flutter/foundation.dart';import 'package:affise_attribution_lib/affise.dart';
class _MyAppState extends State<MyApp> { @override void initState() { super.initState();
Affise .settings( affiseAppId: "Your appId", //Change to your app id secretKey: "Your SDK secretKey", //Change to your SDK secretKey ) .start(); // Start Affise SDK }}Affise.settings(...) (lib/affise.dart:16) returns an AffiseSettings builder (lib/settings/affise_settings.dart:8). Calling start() (lib/settings/affise_settings.dart:122) schedules the init on the next frame via SchedulerBinding.instance.addPostFrameCallback.
Next steps
Section titled “Next steps”For production/debug mode, custom domain, module disabling, init callbacks, and config values, see Optional setup.