Fullscreen placements are interstitial ads covering the whole screen of the device. Hence, it might be important to tell your app to stop running, e.g. if it is a car gaming app, or to resume when the interstitial was dismissed by the user. You can configure frequency capping for fullscreen placements within the Dashboard (e.g. show not more than 1 impression per hour), so you don’t need to implement frequency capping yourself.
You can load 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 a fullscreen placement, call:
placement.startAutoReload()
[self.placement startAutoReload];
This way the fullscreen placement will always aim to have an ad ready. Please also remember to stop the auto-reload when it is no longer needed:
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 the fullscreen placement, call:
placement.reload()
[placement reload];
Display Ad
We strongly recommend calling show() whenever the user triggers the respective event (e.g. clicks a button, starts the next game, and so on). This will ensure proper fill rate statistics on the Dashboard. Do not call show() only, if an ad was loaded successfully before, otherwise, your fill rate statistics will be 100% all the time.
Call show() when your app shall present the fullscreen ad:
placement.show()
[placement show];
The show() method will return a bool value indicating whether the fullscreen placement could be displayed or not. This means whether the fullscreen placement has a ready fullscreen ad or not.
Ad Info
After loading a fullscreen ad, you can access the loaded ad information by accessing the adInfo property of the fullscreen placement:
func aatHaveAd(placement: AATPlacement) {
// The placement has loaded a new ad
let adInfo = self.placement?.adInfo
}
- (void)aatHaveAdWithPlacement:(id<AATPlacement>)placement {
// The placement has loaded a new ad
AATAdInfo *adInfo = self.placement.adInfo;
}
Has Ad
The fullscreen placement provides an API to check if it has a loaded ad.
let hasAd = placement.hasAd()
BOOL hasAd = [self.placement hasAd];
Complete Code Example
class ViewController: UIViewController {
// Create the placement
var placement = AATSDK.createFullscreenPlacement(name: "<placement_name>")
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// [IMPORTANT] Notify AATKit about the currently active view controller
AATSDK.controllerViewDidAppear(controller: self)
// Set placement delegate to listen to the callbacks
placement.delegate = self
// Start autoreloading the placement.
placement.startAutoReload()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// [IMPORTANT] Remove the currently active view controller
AATSDK.controllerViewWillDisappear()
// [IMPORTANT] Stop placement autoreload
placement?.stopAutoReload()
}
@IBAction func startNewGame(_ sender: UIButton) {
// An example for showing the fullscreen ad when the user clicks on "start new game"
placement?.show()
}
}
extension ViewController: AATFullscreenPlacementDelegate {
func aatHaveAd(placement: AATPlacement) {
// The placement has loaded a new ad
}
func aatNoAd(placement: AATPlacement) {
// The placement could not load a new ad
}
func aatAdCurrentlyDisplayed(placement: AATPlacement) {
// Ad has been displayed on the screen
}
func aatResumeAfterAd(placement: AATPlacement) {
// Back to the app
}
}
@interface ViewController () <AATFullscreenPlacementDelegate>
@property id<AATFullscreenPlacement> placement;
@end
@implementation ViewController
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// [IMPORTANT] Notify AATKit about the currently active view controller
[AATSDK controllerViewDidAppearWithController:self];
// Create the placement
self.placement = [AATSDK createFullscreenPlacementWithName:@"<placement_name>"];
// Set placement delegate to listen to the callbacks
self.placement.delegate = self;
// Start autoreloading the placement.
[self.placement startAutoReload];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
// [IMPORTANT] Remove the currently active view controller
[AATSDK controllerViewWillDisappear];
// [IMPORTANT] Stop placement autoreload
[self.placement stopAutoReload];
}
- (IBAction)startNewGame:(UIButton *)sender {
// An example for showing the fullscreen ad when the user clicks on "start new game"
[self.placement show];
}
#pragma mark - AATFullscreenPlacementDelegate
- (void)aatHaveAdWithPlacement:(id<AATPlacement>)placement {
// The placement has loaded a new ad
}
- (void)aatNoAdWithPlacement:(id<AATPlacement>)placement {
// The placement could not load a new ad
}
- (void)aatAdCurrentlyDisplayedWithPlacement:(id<AATPlacement>)placement {
// Ad has been displayed on the screen
}
- (void)aatResumeAfterAdWithPlacement:(id<AATPlacement>)placement {
// Back to the app
}
@end