Skip to content

Integration

This page shows you how to download, configure, and initialize the AppLovin Flutter plugin.

Download the Latest Plugin

Download the AppLovin MAX Flutter plugin through pub.dev by entering the following dependency into your pubspec.yaml under dependencies:

dependencies:
applovin_max: any

You can add that dependency to pubspec.yaml manually, or by issuing the following flutter command:

Terminal window
flutter pub add applovin_max

Install applovin_max

If you added the dependency manually (rather than with the flutter pub add command), issue the following flutter command to install applovin_max:

Terminal window
flutter pub get

(If you add the dependency with the flutter pub add command, this step takes place automatically.)

Initialize the SDK

Import the plugin into your Dart code with this import statement:

import 'package:applovin_max/applovin_max.dart';

Add the code snippet below that calls AppLovinMAX.initialize(). It is best to make this call right before the app runs. You must call AppLovinMAX.initialize() only once:

void main() async {
WidgetsFlutterBinding.ensureInitialized();
MaxConfiguration? conf = await AppLovinMAX.initialize(«sdk-key»);
runApp(MyApp(configuration: conf));
}
class MyApp extends StatefulWidget {
final MaxConfiguration? configuration;
const MyApp({Key? key, this.configuration}) : super(key: key);
@override
State<MyApp> createState() => MyAppState();
}
class MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
// Set up the event listeners and load ads
}
}

You can find your SDK key in the Account > General > Keys section of the AppLovin dashboard.

Ad assets that are fully cached result in a better user experience. For this reason, always initialize the AppLovin SDK on startup. This gives mediated networks the maximum amount of time to cache ads. This is especially important with video ads.

iOS 14 Support

In iOS 14, Apple introduced global privacy policy changes. Apple requires applications to comply with these new policies. If you fail to comply, you may lose revenue. This section explains how to comply.

SKAdNetwork

Update your app’s Info.plist with network-specific identifiers. See the SKAdNetwork documentation for instructions.

You must obtain consent from your users in certain jurisdictions on behalf of AppLovin’s monetization partners. You must also correctly pass consent values to AppLovin. To learn how to do these things, review the Privacy–Consent, Age-Related Flags, and Data APIs documentation.

iOS 15 Global SKAdNetwork Reporting

Starting with iOS 15, Apple allows developers to send a copy of their SKAdNetwork install postbacks to an endpoint of their choice. MAX includes a Global SKAdNetwork Report (MAX > Mediation > Analyze > Global SKA Report). You can use this to access the SKAdNetwork data across all of your network partners in one place.

To leverage the MAX Global SKAdNetwork Report, enable iOS 15 SKAdNetwork reporting by using the app’s Info.plist:

  1. In your app’s Info.plist, create a new key named NSAdvertisingAttributionReportEndpoint of type String.
  2. Give that key the value https://postbacks-app.com.