Wiki
Clone wikiFullscreen and RV Sample / FullScreen documentation
Fullscreen Integration
Creating Fullscreen Placement
to create a Fullscreen placement call the following:
Swift
let fullscreenPlacement = AATSDK.createFullscreenPlacement(name: "Fullscreen")
id fullscreenPlacement = [AATSDK createFullscreenPlacementWithName:@"Fullscreen"];
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>>];
AATSDK.controllerViewDidAppear(controller: <<your Current ViewController>>)
In the ViewController's viewWillDisappear
method, you should do the following:
Objective-C:
[AATSDK controllerViewWillDisappear];
Swift:
AATSDK.controllerViewWillDisappear()
Request Ad
You can request ads for the fullscreen placement either automatically or manually. We strongly recommend using the auto-reload for fullscreen ads, because a fullscreen should be ready to present when the app triggers its presentation.
Automatic Reload
To automatically load fullscreen Placement you can use the following API:
Objective-C:
// Start fullscreen placement auto-reloading to automatically // download a new fullscreen ad after presenting the current one. [self.fullscreenPlacement startAutoReload];
// Start fullscreen placement auto-reloading to automatically // download a 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.
Note: The fullscreen placement fires aatHaveAd(:)
delegate method only once per loaded ad. So, Before starting the auto-reload, you should check for ads from the previous load/auto-reload using the placement has ad API.
Manual Load
To manually load a fullscreen Ad, the following method can be used:
Objective-C:
[self.fullscreenPlacement reload];
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];
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 }
Has Ad
The fullscreen placement provides an API to check if it has a loaded ad.
Objective-C:
BOOL hasAd = [self.placement hasAd];
let hasAd = placement.hasAd()
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
SampleApp
Updated