Migrate to LevelPlay Init API
This guide explains how to transition to the LevelPlay initialization APIs to allow the use of multiple ad unit APIs.
- The min supported SDK is 8.4.0. You can download the latest SDK here.
To initialize the ironSource SDK, follow these steps:Initialize the SDK
// Create a request builder with app key and ad formats. Add User ID if available.
LPMInitRequestBuilder *requestBuilder = [[LPMInitRequestBuilder alloc] initWithAppKey:@"appKey"];
[requestBuilder withLegacyAdFormats:@[IS_REWARDED_VIDEO]];
[requestBuilder withUserId:@"UserId"];
// Build the initial request
LPMInitRequest *initRequest = [requestBuilder build];
// Initialize LevelPlay with the prepared request
[LevelPlay initWithRequest:initRequest completion:^(LPMConfiguration *_Nullable config, NSError *_Nullable error){
if(error) {
// There was an error on initialization. Take necessary actions or retry.
} else {
// Initialization was successful. You can now create ad objects and load ads.
}
}];
// Create a request builder with app key and ad formats. Add User ID if available.
let requestBuilder = LPMInitRequestBuilder(appKey: "appKey")
.withLegacyAdFormats([IS_REWARDED_VIDEO])
.withUserId("UserId")
// Build the initial request
let initRequest = requestBuilder.build()
// Initialize LevelPlay with the prepared request
LevelPlay.initWith(initRequest)
{ config, error in
if let error = error {
// There was an error on initialization. Take necessary actions or retry.
} else {
// Initialization was successful. You can now create ad objects and load ads.
}
}
Initialization result
Success – triggered when the initialization is completed successfully. After you receive this indication, you can create and load the ad.
Error – the configuration was not retrieved successfully and ads cannot be loaded. It is recommended to try and initialize the ironSource SDK later (when internet connection is available, or when the failure reason is resolved)
Legacy | Ad Unit (new) | |
Class | IronSource | LevelPlay |
API | initWithAppKey | initWithRequest |
setUserID | Should be set as part of LPMInitRequestBuilder | |
Callbacks | onInitializationComplete | completion |
– | error |
The Integration Demo application demonstrates how to integrate the Ad Unit APIs in your app. Download Android Demo Application Done! You are now ready to implement the new ad units APIs.LevelPlay mediation demo app