广告聚合

Initialize Mediation

Import the Mediation SDK 🔗

  • import com.chartboost.heliumsdk.HeliumSdk
    
  • import com.chartboost.heliumsdk.HeliumSdk;
    

Initializing the Mediation SDK and setting a HeliumSdkListener 🔗

Using the Mediation application ID and application signature from your dashboard, initialize the Mediation SDK:

  • HeliumSdk.start(this@MyActivityContext, myHeliumAppId, myHeliumAppSignature, heliumSdkListener)
    
  • HeliumSdk.start(MyActivityContext.this, myHeliumAppId, myHeliumAppSignature, heliumSdkListener);
    

Make sure the AppId and AppSignature are Mediation values obtained directly from the Mediation Dashboard for your app and not credentials from Chartboost or any other Ad Network.

In the above example, we’re passing in the heliumSdkListener object to act as our HeliumSdkListener. Implementing the HeliumSdkListener interface allows you to receive notifications about the Mediation SDK’s initialization process:

  •  val heliumSdkListener = object : HeliumSdk.HeliumSdkListener { error -> {
        error?.let {
            Log.d(TAG, "Helium SDK failed to initialize. Reason: ${it.message}")
        } ?: run {
            // SDK Initialized with no errors. 
            Log.d(TAG, "Helium SDK Initialized successfully")
        }
    }
    
  • HeliumSdk.HeliumSdkListener heliumSdkListener = new HeliumSdk.HeliumSdkListener() {
        @Override
        public void didInitialize(Error error) {
            if (error != null) {
                Log.d(TAG,"Helium SDK failed to initialize. Reason: " + error.getMessage());
            } else {
                //SDK Started,
                Log.d(TAG,"Helium SDK initialized successfully");
            }
        }
    };
    

The didInitialize method will be called when the SDK is ready to handle more calls. If the SDK is initialized successfully, then proceed. If the error parameter is not null, it will state the reason why the SDK failed to initialize.

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.

// In the HeliumSdkListener for init success:
val partnerInitializationResultsObserver = object : PartnerInitializationResultsObserver {
    override fun onPartnerInitializationResultsReady(data: PartnerInitializationResultsData) {
        // Data is available in data
    }
}
HeliumSdk.subscribeInitializationResults(partnerInitializationResultsObserver)

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.

// When using HeliumSdk.start():
val skippedPartnerIds = mutableSetOf<String>()
// skippedPartnerIds.add("chartboost") // for example
HeliumSdk.start(context, myHeliumAppId, myHeliumAppSignature, HeliumInitializationOptions(skippedPartnerIds), heliumSdkListener)

Network Adapter Identifiers 🔗

Network Identifier
AdMob admob
Amazon Publisher Services amazon_aps
AppLovin applovin
BidMachine bidmachine
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