Wiki

Clone wiki

Fullscreen and RV Sample / FullScreen documentation

Fullscreen Integration

Index:

  1. Creating Fullscreen Placement
  2. Requesting Fullscreen Ad
  3. Displaying a fullscreen Ad
  4. Assign a specific view controller to a placement
  5. Pubnative close button waiting time
  6. Listening to statistics events
  7. Sample App

Creating Fullscreen Placement

to create a Fullscreen placement call the following:

Swift

let fullscreenPlacement = AATKit.createPlacement(withName: "interstitial", andType: .fullscreen)
Objective-C:
id fullscreenPlacement = [AATKit createPlacementWithName:@"interstitial" andType:AATKitFullscreen];
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.

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];
Swift:
// 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];
Swift:
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];
Swift:
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:
#!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];
   }
}
Swift:
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:
#!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