Splash

Before You Start

Before integrating ads unit in your app, you must:

  • In the OpenMediation UI, create an app and create an ad placement. You can follow guides here.
  • Follow our steps to iOS SDK Integration by integrating the OpenMediation SDK into your project.
  • If you use mediation, go to Add Mediation Networks and make sure you have added the ad networks' SDKs and the corresponding adapters you wish to work with in your app.

Splash

Step 1. Initialize Splash Ad

The OpenMediation SDK fires several events to inform you of Splash Ad activity. To display Splash Ads, one needs to create a brand new OMSplash object, set up its Delegate and load the ads.

Create OMSplash Object

The following snippet demonstrates how to use the OMSplash class to create Splash objects and implement the OMSplashDelegate interface to receive Splash Ad events. The SDK will notify the Delegate of all possible events listed below:

@property (nonatomic, strong) OMSplash *splash;

- (void)viewDidLoad { self.splash = [[OMSplash alloc] initWithPlacementId:@"YOUR_PLACEMENT_ID" adSize:CGSizeMake(self.view.frame.size.width, self.view.frame.size.height)]; self.splash.delegate = self; }
private lazy var splash: OMSplash = {
let splash = OMSplash(placementID: "YOUR_PLACEMENT_ID" frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.width))
splash.delegate = self
return splash
}()

 

Splash Delegate (OMSplashDelegate)

Implement the following callback functions in your code to process ad logic when receiving the status of your ad. For example invoke Show function to serve Ad to your users when the Splash Ad is ready.  

The methods declared by the OMSplashDelegate protocol allow the adopting delegate to respond to messages from the OMSplash class and thus respond to operations such as whether the ad has been loaded, or the user has clicked the ad. 

/// Invoked when the splash ad is available.
- (void)omSplashDidLoad:(OMSplash *)splash {
     NSLog(@"SplashAd Did Load");
}

/// Invoked when the call to load a splash has failed.
/// Parameter error contains the reason for the failure.
- (void)omSplashDidFailToLoad:(OMSplash *)splash withError:(NSError *)error {
     NSLog(@"SplashAd Did Fail");
}

/// Invoked when the splash ad is showing.
- (void)omSplashDidShow:(OMSplash *)splash {
     NSLog(@"SplashAd Did Show");
}

/// Invoked when the user clicks on the splash ad. - (void)omSplashDidClick:(OMSplash *)splash { NSLog(@"SplashAd Did Click"); }
/// Invoked when the splash ad has been closed. - (void)omSplashDidClose:(OMSplash *)splash { NSLog(@"SplashAd Did Close"); }
/// Invoked when the splash ad is available.
func omSplashDidLoad:(_ splash: OMSplash) {
     print(@"SplashAd Did Load")
}

/// Invoked when the call to load a splash has failed.
/// Parameter error contains the reason for the failure.
func omSplashDidFail:(toLoad splash: OMSplash, withError error: Error) {
     print(@"SplashAd Did Fail")
}

/// Invoked when the splash ad is showing.
func omSplashWillExposure:(_ splash: OMSplash) {
     print(@"SplashAd Will Exposure")
}

/// Invoked when the user clicks on the splash ad. func omSplashDidClick(_ splash: OMSplash) { print(@"SplashAd Did Click") }
/// Invoked when the splash ad has been closed. func omSplashDidClick(_ splash: OMSplash) { print(@"SplashAd Did Close") }

 

Step 2. Show a Splash Ad

Invoke the following method to serve a splash ad to your users:

[self.splash showWithWindow:[UIApplication sharedApplication].keyWindow customView:nil];
self.splash.show(with:"WINDOW" customView:"CUSTOM_VIEW")
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.