Initialize Mediation

Add the Import Header 🔗

Add the following import header to the top of any class file that will be using a Mediation class:

  • import ChartboostMediationSDK
    
  • #import <ChartboostMediationSDK/ChartboostMediationSDK-Swift.h>
    

Initialize Mediation 🔗

Using the Mediation AppId and Mediation AppSignature from your Helium Dashboard setup, initialize the Mediation SDK with the following code:

  • Helium.shared().start(withAppId: "MYMEDIATIONAPPID", andAppSignature: "MYMEDIATIONAPPSIGNATURE", options: options, delegate: self)
    
  • [[Helium sharedHelium] startWithAppId:@"MYHELIUMAPPID" andAppSignature:@"MYHELIUMAPPSIGNATURE" options:options delegate:self];
    

Make sure that these are the Mediation AppId and AppSignature values that you obtain directly from your Mediation Dashboard for your app as opposed to credentials from Chartboost or any other Ad Network.

You can implement the HeliumSdkDelegate in your class to receive notifications about the success or failure of the SDK initialization. See Delegate Usage for more details.

Once the Mediation SDK has successfully started, you can start showing ads.

Advanced Settings 🔗

Initialization Metrics 🔗

The Mediation SDK contains an optional callback for receiving SDK initialization metrics in a JSON format. To utilize the API, use the following code snippets. Subscribing is highly recommended once initialization has succeeded.

  • // Subscribing to Mediation SDK initialization results.
    NotificationCenter.default.addObserver(forName: .heliumDidReceiveInitResults, object: nil, queue: nil) { notification in
      // Extract the results JSON payload.
      let results = notification.object as? [String: Any]
    }
    
  • // Subscribing to Mediation SDK initialization results.
    [NSNotificationCenter.defaultCenter addObserverForName:kHeliumDidReceiveInitResultsNotification
                                                    object:nil
                                                     queue:nil
                                                 usingBlock:^(NSNotification * _Nonnull notification) {
        // Extract the results payload.
        NSDictionary *results = (NSDictionary *)notification.object;
    }];
    

Network Kill Switch 🔗

The Mediation SDK initialization method has been expanded to take in optional initialization parameters. One of those parameters is a set of network adapter identifiers to skip initialization for the session.

  • // Create Mediation SDK options to disable specific networks
    let options = HeliumInitializationOptions(skippedPartnerIdentifiers: ["network_identifier", "network_identifier2"])
    let helium = Helium.shared()
    helium.start(withAppId: "appIdentifier", andAppSignature: "appSignature", options: options, delegate: self)
    
  • HeliumInitializationOptions *options = [[HeliumInitializationOptions alloc] initWithSkippedPartnerIdentifiers:@[ @"network_identifier", @"network_identifier2" ]];
    [[Helium sharedHelium] startWithAppId:@"appIdentifier" andAppSignature:@"appSignature" options:options delegate:self];
    

Network Adapter Identifiers 🔗

Network Identifier
AdMob admob
Amazon Publisher Services amazon_aps
AppLovin applovin
Meta Audience Network facebook
Digital Turbine Exchange fyber
Google Bidding google_googlebidding
InMobi inmobi
IronSource ironsource
Mintegral mintegral
Pangle pangle
Unity unity
Vungle vungle
MobileFuse mobilefuse
Verve verve
HyprMX hyprmx