Migrate to LevelPlay Init API
Transition to the LevelPlay initialization APIs to support multiple ad unit APIs, starting from SDK version 8.4.0.
Read time 1 minuteLast updated 4 hours ago
This guide explains how to transition to the LevelPlay initialization APIs to allow the use of multiple ad unit APIs.
Prerequisites
The minimum supported SDK is 8.4.0. You can download the latest SDK here.Initialize the SDK
To initialize the ironSource SDK, follow these steps:- Define the list of ad formats that require support from legacy ironSource API. This should include REWARDED.
- Call the LevelPlay init API using the appKey, ad formats, and user ID if relevant.
- Define the completion handler success and failure.
// 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. } }];
Initialization result
Success
Error
Legacy | Ad Unit (new) | |
---|---|---|
Class | IronSource | LevelPlay |
API | initWithAppKey | initWithRequest |
setUserID | Should be set as part of LPMInitRequestBuilder | |
Callbacks | onInitializationComplete | completion |
- | error |