Large Layout Ad is mediation of standard units that can be configured from the PubNative dashboard. Large Layout Ad view contains a predefined set of icon, banner, title, description, CTA and disclosure view. You can choose an ad type from PubNative dashboard like video only, banner only or description-banner-icon etc. You will get a fully created view in Large Layout that can be shown on screen using show() method. If you want to remove an ad from the screen or you're exiting the activity, you can use hide() method.

Getting Started

  • Before integrating Large Layout Ads in your app, you’ll need to go through the steps in our Getting started guide, create an account on PubNative and integrate the SDK into your project.
  • Add a Large Layout Ad unit to your app in the PubNative dashboard.
  • Make sure you have added the ad network SDKs you wish to use in your app.

For Large Layout Ads, first, you need to create a layout, then integrate lifecycle callbacks and load the ad. After these steps, you can start using it.

Integration Steps

Create Large Layout

You can create predefined Large Layout Ad request using PNLargeLayout.

let largeLayout = PNLargeLayout()
PNLargeLayout *largeLayout = [[PNLargeLayout alloc] init];

Integrate Lifecycle Callbacks for Large Layout

You can track the load process with callbacks using PNLayoutLoadDelegate.

class YourClass: PNLayoutLoadDelegate 
{
//...
func layoutDidFinishLoading(_ layout: PNLayout!)
{
    // Layout loaded
}

func layout(_ layout: PNLayout!, didFailLoading error: Error!)
{
    // Layout load failed
}
//...
}
@interface YourClass () <PNLayoutLoadDelegate>
//...
- (void)layoutDidFinishLoading:(PNLayout *)layout
{
    // Layout loaded
}

- (void)layout:(PNLayout *)layout didFailLoading:(NSError *)error
{
    // Layout load failed
}
//...

You can track the tracking process, user interaction and ad behavior with callbacks using PNLayoutTrackDelegate. But you should set delegate only when Layout has been already loaded.
You need to set the delegate as;

class YourClass: PNLayoutTrackDelegate 
{
//...
largeLayout.trackDelegate = self
//...
func layoutTrackClick(_ layout: PNLayout!) 
{
    // Layout click tracked
}
    
func layoutTrackImpression(_ layout: PNLayout!) 
{
    // Layout impression tracked
}
//...
}
@interface YourClass () <PNLayoutTrackDelegate>
//...
largeLayout.trackDelegate = self;
//...
- (void)layoutTrackImpression:(PNLayout *)layout
{
    // Layout impression tracked
}

- (void)layoutTrackClick:(PNLayout *)layout
{
    // Layout click tracked
}
//...

You can track the view status with callbacks using PNLayoutViewDelegate. But you should set delegate only when Layout has been already loaded.
You need to set the delegate as;

class YourClass: PNLayoutViewDelegate 
{
//...
largeLayout.viewDelegate = self
//...
func layoutDidShow(_ layout: PNLayout!) 
{
    // Layout shown
}
    
func layoutDidHide(_ layout: PNLayout!)
{
    // Layout hidden
}
//...
}
@interface YourClass () <PNLayoutViewDelegate>
//...
largeLayout.viewDelegate = self;
//...
- (void)layoutDidShow:(PNLayout *)layout
{
    // Layout shown
}

- (void)layoutDidHide:(PNLayout *)layout
{
    // Layout hidden
}
//...

Load Large Layout Ad

To load Large Layout Ad;

largeLayout.load(withAppToken: "<YOUR_APP_TOKEN>", placement: "<YOUR_PLACEMENT>", delegate: self)
[largeLayout loadWithAppToken:@"<YOUR_APP_TOKEN>" placement:@"<YOUR_PLACEMENT>" delegate:self];

In order to get callbacks from PNLayout, you should implement PNLayoutLoadDelegate for your class. Once an ad is loaded, you will get a fully created view in Large Layout that can be shown on screen using show() method. If you want to remove an ad from the screen, you can use hide() method.

Use Large Layout Ad

Once the load callback is invoked you can show the ad using the show() method or hide externally using hide(). Expect the user to close the ad by itself unless you have a specific need to hide it. If the ad is not ready any interaction with this method will do nothing.

// Use this to show the fullscreen interstitial
largeLayout.show()
// Use this to hide the fullscreen interstitial
largeLayout.hide()
// Use this to show the fullscreen interstitial
[largeLayout show];
// Use this to hide the fullscreen interstitial
[largeLayout hide];