Skip to main content
Table of contents

Introduction

This guide explains how to integrate Criteo Direct Bidding for App solution to your Android app as a Standalone Ads SDK.

Prerequisites

Standalone SDK - SDK Initialization

Initialize Criteo SDK in your Application class by using Criteo.Builder() method. This needs to be done only once. Criteo.Builder() method takes 2 parameters:

Parameter

Type

Description

application

Application

Application Object

criteoPublisherId

String

Your Criteo Publisher ID.
Contact your Criteo representative to get your Criteo Publisher ID.

Use adUnits() method on the builder and pass List<AdUnit> object to initialize all ad units that Criteo will monetize.

Banner - Displaying Banner

Add CriteoBannerView into your XML layout, with the following attributes:

Parameter

Type

Description

app:criteoAdUnitId

String

Your Criteo banner Ad Unit ID

app:criteoAdUnitHeight

Integer

Banner height

app:criteoAdUnitWidth

Integer

Banner width

<com.criteo.publisher.CriteoBannerViewandroid:id="@+id/criteoBannerView"android:layout_width="match_parent"android:layout_height="wrap_content"app:criteoAdUnitId="samplebanneradunitid"app:criteoAdUnitWidth="320"app:criteoAdUnitHeight="50" />

Then, call loadAd() in your code to display Criteo banner.

Banner - Displaying Banner Continued

Alternatively, create a CriteoBannerView object programatically, call loadAd() method, and add it as a subview in your layout.

Banner - Destroying Banner View

Make sure to destroy CriteoBannerView object when your Activity is destroyed.

Banner - Setting Ad Listener

You can optionally add an Ad Listener to your CriteoBannerView object in order to handle callbacks when banner view has loaded, failed to load, or there's a click resulting in the user leaving the application, by calling setCriteoBannerAdListener() with a CriteoBannerAdListener object as parameter, before loading the ad.

Interstitial - Loading Interstitial Ads

You can request for Interstitial Ad by creating a CriteoInterstitial object for your Interstitial Ad Unit, and call loadAd(). This will prefetch an Interstitial Ad that you can display later in your app.

Interstitial - Displaying Interstitial Ads

Display previously-loaded Interstitial ad by calling show() method. Make sure to always check whether the Interstitial ad has been loaded using isAdLoaded() before presenting Criteo Interstitial ad to the user.

Interstitial - Setting Ad Listener

You can optionally add an Ad Listener to your CriteoInterstitial object in order to handle callbacks when Interstitial view has loaded, failed to load, opened, closed or there's a click resulting in the user leaving the application, by calling setCriteoInterstitialAdListener() with a CriteoInterstitialAdListener object as parameter, before loading the ad.

Sample

See sample implementation of Criteo Standalone integration in GitHub.