Skip to main content

Flutter Integration

This page guides you through the process of downloading, importing, and configuring the Yodo1 MAS SDK for Flutter.

Prerequisites

To integrate the Yodo1 MAS SDK on Flutter, you need to meet the following requirements:

  • For Android:
    • Minimum API Level 23 or above
    • Target API Level 33 or above
    • If you use Proguard, please refer to the documentation
  • For iOS:
    • iOS 13.0 or above
    • Xcode 15.2 or above
    • CocoaPods 1.10.0 or above

Installation

Add the Yodo1 MAS Flutter plugin to your pubspec.yaml:

dependencies:
yodo1_mas_flutter_plugin: ^0.0.6

Then run:

flutter pub get

Android Setup

Configure build.gradle

  1. Add repositories to your project-level build.gradle:
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://artifact.bytedance.com/repository/pangle" }
maven { url "https://android-sdk.is.com" }
maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" }
maven { url "https://artifactory.bidmachine.io/bidmachine" }
maven { url "https://ysonetwork.s3.eu-west-3.amazonaws.com/sdk/android" }
maven { url "https://artifacts.applovin.com/android/beta/" }
}
}
  1. Enable MultiDex in your app-level build.gradle:
android {
defaultConfig {
multiDexEnabled true
minSdkVersion 23
}
}

Configure AndroidManifest.xml

Add your AdMob app ID to AndroidManifest.xml:

<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="YOUR_ADMOB_APP_ID"/>
</application>
</manifest>

iOS Setup

Configure Info.plist

  1. Add AppLovin SDK Key:
<key>AppLovinSdkKey</key>
<string>xcGD2fy-GdmiZQapx_kUSy5SMKyLoXBk8RyB5u9MVv34KetGdbl4XrXvAUFy0Qg9scKyVTI0NM4i_yzdXih4XE</string>
  1. Add App Tracking Transparency permission:
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
  1. Add AdMob app ID:
<key>GADApplicationIdentifier</key>
<string>YOUR_ADMOB_APP_ID</string>

Initialize the SDK

You need to add your Appkey manually in your project if you haven’t added your game’s store link in the MAS dashboard yet. You can find your app key in MAS dashboard.

Initialize the SDK in your app:

import 'package:yodo1_mas_flutter_plugin/constants.dart';
import 'package:yodo1_mas_flutter_plugin/yodo1_mas_flutter_plugin.dart';
// Initialize plugin variable
final _yodo1MasFlutterPlugin = Yodo1MasFlutterPlugin();

@override
void initState() {
super.initState();
/**
* Initialize MAS SDK with the parameters
* appKey - Your appKey from MAS Dashboard
* privacy (bool) - Whether to use MAS privacy dialog or your own
* ccpa (bool) - See https://developers.yodo1.com/docs/sdk/getting_started/legal/ccpa
* coppa (bool) - See https://developers.yodo1.com/docs/sdk/getting_started/legal/coppa
* gdpr (bool) - See https://developers.yodo1.com/docs/sdk/getting_started/legal/gdpr
*/
yodo1MasFlutterPlugin.initSdk("<your appKey>", true, true, false, false);
// You may also listen to flutter initialization statuses
yodo1MasFlutterPlugin.setInitListener((bool successful) {
print('Yodo1 Flutter Init status $successful');
});
}

Configure COPPA

// For users under 13
await yodo1MasFlutterPlugin.setCOPPA(true);

// For users 13 and above
await yodo1MasFlutterPlugin.setCOPPA(false);

Configure GDPR

// For users who consent to data collection
await yodo1MasFlutterPlugin.setGDPR(true);

// For users who don't consent or are under 16
await yodo1MasFlutterPlugin.setGDPR(false);

Configure CCPA

// For users who opt out of data collection
await yodo1MasFlutterPlugin.setCCPA(true);

// For users who have not opted out
await yodo1MasFlutterPlugin.setCCPA(false);