Unable to show the AppOpen on the initial launch or cold start. i am getting the error as Attempted to load ad before SDK initialization. Please wait until after the SDK has initialized,

I have initialized the Applovin SDK in the Application, so it show the AppOpen on the every screens. But when I am launching initially it shows Attempted to load ad before SDK.

Background to foreground is working fine without any errors.

Initialized the AppOpen globaly in the app. Still failed to load the Ad on cold launch and shows the Attempt to load ad before SDK initialized

        AppLovinSdk.getInstance( applicationContext ).setMediationProvider( "max" );
        AppLovinSdk.getInstance(this).initializeSdk()

        val sdk = AppLovinSdk.getInstance(this)
        sdk.settings.isMuted = true // to mute
        if (BuildConfig.DEBUG) {
            sdk.showMediationDebugger()
            AppLovinSdk.getInstance(this).settings.setVerboseLogging(true)
        }
1

There are 1 best solutions below

3
On

You can use the callback to know whether the SDK is fully initialized or not,

class MainActivity : Activity()
{
    override fun onCreate(savedInstanceState: Bundle?)
    {
        // Make sure to set the mediation provider value to "max" to ensure proper functionality
        AppLovinSdk.getInstance( context ).setMediationProvider( "max" )
        AppLovinSdk.getInstance( context ).initializeSdk({ configuration: AppLovinSdkConfiguration ->
            // AppLovin SDK is initialized, start loading ads
        })
    }
} 

Once the SDK is fully initialized you can load the ad on starup.