Wiki
Clone wikiFullscreen and RV Sample / FullScreen documentation (AATKit2)
Fullscreen Integration
Creating Fullscreen Placement
to create a Fullscreen placement call the following:
Swift
let fullscreenPlacement = AATKit.createPlacement(withName: "interstitial", andType: .fullscreen)
id fullscreenPlacement = [AATKit createPlacementWithName:@"interstitial" andType:AATKitFullscreen];
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.
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. [AATKit startPlacementAutoReload:self.fullscreenPlacement];
// Start fullscreen placement auto-reloading to automatically // download new fullscreen ad after presenting the current one. AATKit.startPlacementAutoReload(fullscreenPlacement)
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:
[AATKit reloadPlacement:fullscreenPlacement];
AATKit.reload(fullscreenPlacement)
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:
[AATKit showPlacement:fullscreenPlacement];
AATKit.show(fullscreenPlacement)
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. Thus, it is possible to use the following construct to react based on whether the fullscreen placement was displayed or not:
Objective-C:
#!objective-c if ( ! [AATKit showPlacement:fullscreenPlacement] ) { NSLog(@"Fullscreen Ad could not be displayed"); }
#!swift if !AATKit.show(fullscreenPlacement) { print("Fullscreen Ad could not be displayed") }
Calling the method showPlacemen
does increase the AdSpace count, which is used to calculate the fill rate. An AdSpace expresses the intention to show an ad.
Another approach to receive feedback indicating whether the fullscreen Ad is ready for display, is to use the AATKit delegate callbacks AATKitHaveAd:
.
Warning : This callback should be used for banner and rewarded video placements only. It's not recommended to use this callback for fullscreen placements. Trying to display a fullscreen placement by reacting on the callback, prevents counting an AdSpace (by not calling showPlacement
) if no ad is available. Example call:
Objective-C:
- (void) AATKitHaveAd:(id)placement { if ([placement isEqual:[AATKit getPlacementWithName:@"interstitial"]]){ [AATKit showPlacement:placement]; } }
func aatKitHaveAd(_ placement: AATKitPlacement) { if placement.isEqual(AATKit.getPlacementWithName("interstitial")) { AATKit.show(placement) } }
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:
Objective-C:
[AATKit setPlacementViewController:self forPlacement:fullscreenPlacement];
#!swift [AATKit setPlacementViewController:self forPlacement:fullscreenPlacement];
Setting a placement-specific view controller will override any global view controller.
Pubnative close button waiting time
You can set the close button waiting time for Pubnative interstitial by adding the key AATKitPubnativeOffsetSecsHTMLInterstitial
to your Info.plist and set it to the desired value in seconds
Listening to statistics events
AATKitStatisticsDelegate 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 method
+ (nullable NSObject<AATKitPlacement>*) createPlacementWithName:(nonnull NSString *) placementName andType:(AATKitAdType)type andStatisticsDelegate:(nullable NSObject <AATKitStatisticsDelegate>*)statisticsDelegate
Updating statistics delegate instance
You can pass a new statistics delegate instance to the placement by using the following method in AATKitPlacement:
- (void)updateStatisticsDelegate:(nonnull NSObject <AATKitStatisticsDelegate> *)statisticsDelegate;
for more info about it please refer to AATKitStatisticsDelegate Guide
SampleApp
Updated