Google IMA ads in Android/IOS/Flutter

harsh shah
3 min readApr 24, 2022

Interactive Media Ads (IMA) is a suite of SDKs that make it easy to integrate multimedia ads into your websites and apps. IMA SDKs can request ads from any VAST-compliant ad server and manage ad playback in your apps. IMA can also display companion ads, report metrics to ad servers, and incorporate key buying signals, such as Active View viewability, IDFA/ADID, and content targeting

There are two ways to implement IMA SDKs: client-side, which combines ad and content video within your app, and dynamic ad insertion (DAI), which combines ad and content video on the Ad Manager servers, and then returns a single video stream to your app for playback.

With IMA client-side SDKs, you maintain control of content video playback, while the SDK handles ad playback. Ads play in a separate video player positioned on top of the app’s content video player

IMA client-side overview

Implementing IMA client-side involves four main SDK components, which are demonstrated in this guide:

  • AdDisplayContainer: A container object where ads are rendered.
  • AdsLoader: An object that requests ads and handles events from ads request responses. You should only instantiate one ads loader, which can be reused throughout the life of the application.
  • AdsRequest: An object that defines an ads request. Ads requests specify the URL for the VAST ad tag, as well as additional parameters, such as ad dimensions.
  • AdsManager: An object that contains the response to the ads request, controls ad playback, and listens for ad events fired by the SDK.

With IMA DAI SDKs, apps make a stream request for ad and content video — either VOD or live content. The SDK then returns a combined video stream, so that you don’t have to manage switching between ad and content video within your app

IMA DAI overview

Implementing IMA DAI involves four main SDK components, which are demonstrated in this guide:

  • StreamDisplayContainer: A container object that sits on top of the video playback element and houses the ad UI elements.
  • AdsLoader: An object that requests streams and handles events triggered by stream request response objects. You should only instantiate one ads loader, which can be reused throughout the life of the application.
  • StreamRequest: An object that defines a stream request. Stream requests can either be for video-on-demand or live streams. Requests specify a content ID, as well as an API key or authentication token and other parameters.
  • StreamManager: An object that handles dynamic ad insertion streams and interactions with the DAI backend. The stream manager also handles tracking pings and forwards stream and ad events to the publisher.

If you want to integrate ads in a different platform follow this link (https://github.com/googleads)

Sample ad tags

Currently, IMA SDK is not available on flutter but actually, I have integrated IMA SDK on flutter through PlatformView so next story I will explain how to integrate IMA SDK on flutter.

If you want to integrate live ads you can set up an account in Google ad manager

--

--

harsh shah

Mobile Developer (Android , flutter) - 5 Years , Worked on multiple domain like pharma , financial , Ecommerce , BLE .