Wiki
Clone wikiFullscreen and RV Sample / Fullscreen migration to AATKit 3 migration
Fullscreen migration to AATKit 3 migration (beta)
Creating Fullscreen Placement
to create a Fullscreen placement call the following:
Instead of:
Swift
let fullscreenPlacement = AATKit.createPlacement(withName: "interstitial", andType: .fullscreen)
id fullscreenPlacement = [AATKit createPlacementWithName:@"interstitial" andType:AATKitFullscreen];
Use:
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.
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
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.
Instead of:
Objective-C:
// Start fullscreen placement auto-reloading to automatically // download new fullscreen ad after presenting the current one. [AATKit startPlacementAutoReload:self.fullscreenPlacement];
// Start fullscreen placement auto-reloading to automatically // download new fullscreen ad after presenting the current one. AATKit.startPlacementAutoReload(fullscreenPlacement)
Use:
Objective-C:
// Start fullscreen placement auto-reloading to automatically // download new fullscreen ad after presenting the current one. [self.fullscreenPlacement startAutoReload];
// 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.
Manual Load
To manually load a fullscreen Ad, the following method can be used:
Instead of:
Objective-C:
[AATKit reloadPlacement:fullscreenPlacement];
AATKit.reload(fullscreenPlacement)
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:
Instead of:
Objective-C:
[AATKit showPlacement:fullscreenPlacement];
AATKit.show(fullscreenPlacement)
Use:
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 }
Assign a specific view controller to a placement
Setting a view controller during initialization of the AATKit, or by using the method + (void) setViewController:(nullable UIViewController*)con;
sets a global view controller used by all placements.
It's also possible to assign a placement specific view controller, by using the following method:
Instead of:
Objective-C:
[AATKit setPlacementViewController:self forPlacement:fullscreenPlacement];
#!swift [AATKit setPlacementViewController:self forPlacement:fullscreenPlacement];
Use:
Objective-C:
[AATSDK controllerViewDidAppearWithController:self];
Swift:
#!swift AATSDK.controllerViewDidAppear(controller: self)
In the ViewController's viewWillDisappear
method, you should do the following:
Objective-C:
[AATSDK controllerViewWillDisappear];
Swift:
#!swift AATSDK.controllerViewWillDisappear()
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