This native implementation is specifically designed to fit feed views
You can customize view to look a like other cells around an offer immersive experience
This article shows you how to deliver Teads ads on your application using the AdMob adapter or Google Ad Manager (GAM) Mediation adapter.
Sample App on GitHub
Teads inApp SDK Flutter sample App
Prerequisites
Flutter
- Flutter: >= 2.5.0
iOS
- Teads iOS SDK: >= 5.0.22
- Teads iOS Admob adapter: >= 5.0.22
- Platform: iOS 10+ (99% of the devices)
Android
- Teads Android SDK: >= 5.0.22
- Teads Android Admob adapter: >= 5.0.22
Installation
Before installing the Teads AdMob adapter, you will need to integrate GoogleMobileAds SDK into your application.
Using packages
To add the package, teads_admob_adapter
, to an app:
- Depend on it
- Open the pubspec.yaml file located inside the app folder, and add
teads_admob_adapter
: under dependencies.
- Open the pubspec.yaml file located inside the app folder, and add
- Install it
- From the terminal: Run
flutter pub get
.
OR - From Android Studio/IntelliJ: Click Packages get in the action ribbon at the top of pubspec.yaml.
OR - From VS Code: Click Get Packages located in right side of the action ribbon at the top of pubspec.yaml.
- From the terminal: Run
- Import it
- Add a corresponding import statement in the Dart code.
Defining a Custom Event
In order to display a Teads ad using AdMob or Google Ad Manager mediation,
you need to create a custom event.
See this article for more test PIDs serving different creative formats.
Follow the custom event documentation on the AdMob dashboard using the below values.
Or
Follow the custom event documentation on Google Ad Manager using the below values.
iOS
Name | Value |
---|---|
Class Name | TeadsAdMobAdapter.GADMAdapterTeadsNative |
Parameter | Teads placement ID (PID) |
Android
Name | Value |
---|---|
Class Name | tv.teads.adapter.admob.nativead.TeadsNativeAdapter |
Parameter | Teads placement ID (PID) |
Integration
Important
You're responsible for positioning the elements (title label, main image, call to action button…). Those elements need to be visible (without overlay, even transparent ones) otherwise our visibility algorithm will consider the ad view as hidden.
Settings
You have the ability to pass extra parameters in order to customize third-party ad network settings. For Teads, you need to create TeadsAdapterSettings
.
- Create an instance of
TeadsAdapterSettings
and add the settings you want before loading an ad.
Future<void> _requestAd() async {
// Instantiate an AdManagerAdRequest object
AdManagerAdRequest request = const AdManagerAdRequest(mediationExtrasIdentifier: "Teads");
// Create custom Teads settings
TeadsAdapterSettings settings = TeadsAdapterSettings();
await settings.enableDebug();
// Prepare the ad object
NativeAd(
adUnitId: widget.selectedFormat.pid,
request: request,
factoryId: 'admobNativeAd',
listener: NativeAdListener(
// Called when an ad is successfully received.
onAdLoaded: (Ad ad) {
setState(() {
_nativeAd = ad as NativeAd;
});
},
// Called when an ad request failed.
onAdFailedToLoad: (Ad ad, LoadAdError error) {
// Dispose the ad here to free resources.
ad.dispose();
print('Ad failed to load: $error');
},
// Called when an ad opens an overlay that covers the screen.
onAdOpened: (Ad ad) => print('Ad opened.'),
// Called when an ad removes an overlay that covers the screen.
onAdClosed: (Ad ad) => print('Ad closed.'),
// Called when an impression occurs on the ad.
onAdImpression: (Ad ad) => print('Ad impression.'),
)
).load();
}
iOS
In your AppDelegate
, in the didFinishLaunchingWithOptions
function, add the following:
import google_mobile_ads
import teads_admob_adapter
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
...
FLTGoogleMobileAdsPlugin.register(FLTTeadsMediationNetworkExtras(), registry: self)
...
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
Android
In your MainActivity
, in the configureFlutterEngine
function, add the following:
import io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin
import tv.teads.teadsadmobadapter.teads_admob_adapter.FLTTeadsMediationNativeNetworkExtras
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
...
GoogleMobileAdsPlugin.registerMediationNetworkExtrasProvider(
flutterEngine, FLTTeadsMediationNativeNetworkExtras()
)
...
}
Interface
Please refer to the Google Mobile Ads Flutter Native documentation for the interface.
Mediation settings
Find the full settings list here