Wiki

Clone wiki

AATKit iOS / Proposal / Fullscreen

Integrate a fullscreen Ad
 into your project

  1. Getting Started
  2. AATKit Initialisation
  3. Consent Handling
  4. Formats
  5. Targeting
  6. Advanced

Fullscreen

Creating Fullscreen Placement

to create a Fullscreen placement call the following:

Swift

let fullscreenPlacement = AATSDK.createFullscreenPlacement(name: "Fullscreen")
Objective-C:
id fullscreenPlacement = [AATSDK createFullscreenPlacementWithName:@"Fullscreen"];
You have to specify a placement name, which allows for referencing the placement later on. Also the type argument specifies the size of the ad to be displayed.

Note placement instance is supposed to be reused. Do not create a placement instance for each fullscreen ad you want to display. Each location where fullscreen ads should be displayed, can be handled by a single placement instance.

Setting the view controller

You can set the current view controller for AATKit, you should set the viewController in your viewController viewDidAppear method.

Objective-C:

[AATSDK controllerViewDidAppearWithController:<<your Current ViewController>>];
Swift:
AATSDK.controllerViewDidAppear(controller: <<your Current ViewController>>)

In the ViewController's viewWillDisappear method, you should do the following:

Objective-C:

[AATSDK controllerViewWillDisappear];

Swift:

AATSDK.controllerViewWillDisappear()

Requesting Fullscreen Ad

after that to request an Ad you can automatically load and reload fullscreen placements or manually load fullscreen placements

To automatically load fullscreen Placement you can use:

Objective-C:

// Start fullscreen placement auto-reloading to automatically
// download new fullscreen ad after presenting the current one.
[self.fullscreenPlacement startAutoReload];
Swift:
// Start fullscreen placement auto-reloading to automatically
// download new fullscreen ad after presenting the current one.
fullscreenPlacement.startAutoReload()

In this scenario, a fullscreen Ad is loaded automatically. It is reloaded only if a previous fullscreen Ad has already been displayed.

To manually loading a fullscreen Ad, the following method can be used:

Objective-C:

[self.fullscreenPlacement reload];
Swift:
fullscreenPlacement?.reload()

Displaying a fullscreen Ad

Displaying a fullscreen Ad can be done in two ways.

First, the AATKit can be told to display a fullscreen placement using the following method:

Objective-C:

[self.fullscreenPlacement show];
Swift:
fullscreenPlacement.show()

The method will return a bool value indicating whether the fullscreen placement could be displayed or not. This means whether the fullscreen placement could be filled with an Ad by an Ad network.

Listening to Events

To register for the placement events, set the delegate property on AATFullscreenPlacement to an object that implements the AATFullscreenPlacementDelegate protocol.

Objective-C:

[self.placement setDelegate:self];

Swift:

placement.delegate = self

Implementing AATFullscreenPlacementDelegate

    func aatHaveAd() {
        /// This method will be called when there is an ad
    }

    func aatNoAd() {
        /// This method will be called when there is no ad available
    }

    func aatAdCurrentlyDisplayed() {
        /// This method will be called with the ad display event
    }

    func aatResumeAfterAd() {
        /// This method will be called when the app resumes after displaying an ad
    }

Listening to statistics events

AATStatisticsDelegate is an optional delegate you can implement if you need to get notified about statistics events. and pass it to placement while creating it using this Use:

placement.statisticsDelegate = self
for more info about it please refer to AATStatisticsDelegate Guide

SampleApp

back (Home)

Updated