For the latest instructions on how to load and show rewarded ads, see the MAX Integration Guide: (Adobe AIR, Android, iOS, Cordova, React Native, Unity).
- If you use Android, integrate Google Play Services.
- Initialize the AppLovin SDK as soon as possible after your app starts:
iOS [ALSdk initializeSdk];
Android AppLovinSdk.initializeSdk(context);
- Implement the
ALAdLoadDelegate
(iOS) orAppLovinAdLoadListener
(Android) in the class you want to receive load callbacks. - Implement the
ALAdRewardDelegate
(iOS) orAppLovinAdRewardListener
(Android) in the class you want to receive load callbacks. - Tell the SDK to preload a rewarded video. AppLovin recommends that you give the SDK time to finish caching ads before making this call. The response will be almost immediate if an available ad has been cached, but making this call while the SDK is caching can dramatically slow down the process.
iOS [ALIncentivizedInterstitialAd preloadAndNotify:nil];
Android myIncentInter.preload(null);
- When you are ready to show an ad, check to see if one is available with the synchronous check. You can then simply show the ad or use your fallback logic if one is unavailable:
iOS if([ALIncentivizedInterstitialAd isReadyForDisplay]){ [ALIncentivizedInterstitialAd show]; } else{ // Perform fallback logic }
Android if(myIncentInter.isReadytoDisplay()){ myIncentInter.show(…); } else{ // Perform fallback logic }