Skip to content

Integration Flow ​

An Android integration is split between Infillion and the publisher. Infillion provides the VAST tag and renders the interactive ad. The publisher's app finds the Infillion ad in its ad break, hands it to TruexAdRenderer, and moves the playback timeline forward when the renderer is done.

  1. Infillion provides a test VAST tag

    Your Infillion contact provides a test VAST tag that fits your ad setup. The generic tag is the preferred option. The companion tag is used when it works better with your ad stack, for example with Google IMA DAI. Both formats are described in VAST Tag Types.

  2. The publisher traffics the tag

    Your ad ops team schedules the tag in your ad server. A TrueX tag must be the first ad in the pod. An IDVx tag can be placed in any slot.

  3. The publisher integrates the SDK

    Your app resolves adParameters from the ad, starts the renderer when the ad plays, and handles the terminal events.

Resolving adParameters ​

The renderer is initialized with an adParameters JSONObject. Where that JSON comes from depends on the VAST tag format and the ad framework your app uses:

Tag formatWhere adParameters is in the VASTGoogle IMA (CSAI and DAI)Custom VAST parsing
Generic<Linear><AdParameters> as a JSON stringad.traffickingParametersText content of <AdParameters>
Companion<Companion apiFramework="truex"><StaticResource creativeType="application/json"> as a base64 JSON data: URLad.companionAds (apiFramework is truex)Text content of <StaticResource>, base64-decoded after the comma

To support both formats, resolve the payload in this order:

  1. Look for a companion with apiFramework="truex" and decode its JSON.
  2. If there is none, parse the <AdParameters> JSON.
  3. If neither one gives valid JSON, do not start the renderer. Treat the ad as a normal linear ad and continue the pod.

Before resolving the payload, identify the ad by its <AdSystem> value (ad.adSystem in Google IMA). trueX is a TrueX ad and IDVx is an IDVx ad; any other value is a regular linear ad. A TrueX ad that is not the first ad in the pod should play as a regular linear ad.

The TV examples contain complete resolvers for Google IMA and for custom VAST parsing.

Starting the Renderer ​

When the Infillion ad starts playing:

  1. Pause the ad playback (for Google IMA, pause the AdsManager or the stream) and hide the video player.
  2. Create a TruexAdRenderer, add your event listener, and call init with the adParameters JSON.
  3. Call start with the full-screen ViewGroup above your player.
  4. Wait for a terminal event. While you wait, keep track of whether AD_FREE_POD has fired.

The calls are described in SDK Integration.

Handling Terminal Events ​

A terminal event means the renderer is done, and your app must move the playback timeline forward. What "forward" means depends on whether the user earned the ad-free pod reward and on how your ads are inserted:

Renderer resultWhat to doCSAI (e.g. Google IMA)SSAI (e.g. Google IMA DAI)
AD_COMPLETED after AD_FREE_PODSkip all remaining ads in the pod and continue the contentDiscard the ad break (adsManager.discardAdBreak())Seek to the ad break start plus the break duration
AD_COMPLETED without AD_FREE_PODSkip the Infillion placeholder ad and play the next ad in the podFinish the placeholder ad and resume the ad managerSeek to the end of the placeholder ad
AD_ERROR or NO_ADS_AVAILABLESame as AD_COMPLETED without AD_FREE_PODSameSame
USER_CANCEL_STREAMThe user pressed Back during the Infillion ad - exit the playback screenClose the playerClose the player

AD_COMPLETED without AD_FREE_POD covers a TrueX user who opted out or let the choice card time out, and it is the normal outcome of every IDVx ad, because IDVx never fires AD_FREE_POD.

IMPORTANT

Do not seek or resume playback when AD_FREE_POD fires. Remember that it fired, and act only on the terminal event that follows.

After any terminal event, remove your listeners, call stop(), and drop all references to the renderer instance. The full list of terminal events is on the Events page.

Integration documentation for Infillion Ads