Use the latest Amazon Publisher Services adapter version to avoid reporting discrepancies.
Add the Amazon Publisher Services Adapter Plugin
Download and import the APS Unity plugin from Amazon Publisher Services.
To install or upgrade the Amazon Publisher Services adapter, select Amazon > Manage SDKs from the Unity menu bar. When the Amazon SDK Manager appears, click Install next to AppLovin MAX.
Add Permissions to the Android Manifest
If you want to pass geo location information, include the following permissions in your manifest file:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Initialize the Amazon SDK
The Amazon Publisher Services SDK requires that you initialize it outside of MAX SDK:
Amazon.Initialize(amazonAppId); Amazon.SetAdNetworkInfo(new AdNetworkInfo(DTBAdNetwork.MAX));
Load a Banner Ad from Amazon’s SDK
To integrate Amazon banner ads into MAX, you must load the Amazon ad first, then pass the response object into MaxSdk
by calling MaxSdk#SetBannerLocalExtraParameter()
before you create the MAX banner ad.
For auto-refreshing banner ads you need to load the ad only once.
public class MainMenu : MonoBehaviour { ⋮ private void loadAd() { int width; int height; string slotId; if (MaxSdkUtils.IsTablet()) { width = 728; height = 90; slotId = "Amazon-leader-slot-ID"; } else { width = 320; height = 50; slotId = "Amazon-banner-slot-ID"; } var apsBanner = new APSBannerAdRequest(width, height, slotId); apsBanner.onSuccess += (adResponse) => { MaxSdk.SetBannerLocalExtraParameter(banner-ad-unit-ID, "amazon_ad_response", adResponse.GetResponse()); CreateMaxBannerAd(); }; apsBanner.onFailedWithError += (adError) => { MaxSdk.SetBannerLocalExtraParameter(banner-ad-unit-ID, "amazon_ad_error", adError.GetAdError()); CreateMaxBannerAd(); }; apsBanner.LoadAd(); } private void CreateMaxBannerAd() { MaxSdk.CreateBanner(banner-ad-unit-ID, MaxSdkBase.BannerPosition.BottomCenter); MaxSdk.SetBannerPlacement(banner-ad-unit-ID, "banner-placement"); } }
Load an MREC ad from Amazon’s SDK
To integrate Amazon MREC ads into MAX, you must load the Amazon ad first, then pass the response object into MaxSdk
by calling MaxSdk#SetMRecLocalExtraParameter()
before you create the MAX MREC ad.
public class MainMenu : MonoBehaviour { ⋮ private void loadAd() { var apsMRec = new APSBannerAdRequest(300, 250, Amazon-MREC-slot-ID); apsMRec.onSuccess += (adResponse) => { MaxSdk.SetMRecLocalExtraParameter(ad-unit-ID, "amazon_ad_response", adResponse.GetResponse()); CreateMaxMRecAd(); }; apsMRec.onFailedWithError += (adError) => { MaxSdk.SetMRecLocalExtraParameter(ad-unit-ID, "amazon_ad_error", adError.GetAdError()); CreateMaxMRecAd(); }; apsMRec.LoadAd(); } private void CreateMaxMRecAd() { MaxSdk.CreateMRec(mrecAdUnitId, MaxSdkBase.AdViewPosition.Centered); MaxSdk.setMRecPlacement(ad-unit-ID, "placement"); } }
Load an Interstitial Ad from Amazon’s SDK
To integrate Amazon interstitial ads into MAX, you must load the Amazon ad first, then pass the response object into MaxSdk
by calling MaxSdk#SetInterstitialLocalExtraParameter()
before you create the MAX intersitital ad.
You must load and pass the Amazon response object into MaxSdk
as the local extra parameter only once per session.
-
public class MainMenu : MonoBehaviour { private bool IsFirstLoad = true; private void LoadAd() { if (IsFirstLoad) { IsFirstLoad = false; var interstitialAd = new APSInterstitialAdRequest(Amazon-inter-slot-ID); interstitialAd.onSuccess += (adResponse) => { MaxSdk.SetInterstitialLocalExtraParameter(ad-unit-ID, "amazon_ad_response", adResponse.GetResponse()); MaxSdk.LoadInterstitial(ad-unit-ID); }; interstitialAd.onFailedWithError += (adError) => { MaxSdk.SetInterstitialLocalExtraParameter(ad-unit-ID, "amazon_ad_error", adError.GetAdError()); MaxSdk.LoadInterstitial(ad-unit-ID); }; interstitialAd.LoadAd(); } else { MaxSdk.LoadInterstitial(ad-unit-ID); } } }
-
public class MainMenu : MonoBehaviour { private bool IsFirstLoad = true; private void LoadAd() { if (IsFirstLoad) { IsFirstLoad = false; var interstitialVideoAd = new APSVideoAdRequest(320, 480, Amazon-video-inter-slot-ID); interstitialVideoAd.onSuccess += (adResponse) => { MaxSdk.SetInterstitialLocalExtraParameter(ad-unit-ID, "amazon_ad_response", adResponse.GetResponse()); MaxSdk.LoadInterstitial(ad-unit-ID); }; interstitialVideoAd.onFailedWithError += (adError) => { MaxSdk.SetInterstitialLocalExtraParameter(ad-unit-ID, "amazon_ad_error", adError.GetAdError()); MaxSdk.LoadInterstitial(ad-unit-ID); }; interstitialVideoAd.LoadAd(); } else { MaxSdk.LoadInterstitial(ad-unit-ID); } } }
Load a Rewarded Video Ad from Amazon’s SDK
To integrate Amazon rewarded video ads into MAX, you must load the Amazon ad first, then pass the response object into MaxSdk
by calling MaxSdk#SetRewardedAdLocalExtraParameter()
before you load the MAX ad.
You must load and pass the Amazon response object into MaxSdk
as the local extra parameter only once per session.
public class MainMenu : MonoBehaviour { private bool IsFirstLoad = true; private void LoadAd() { if (IsFirstLoad) { IsFirstLoad = false; var rewardedVideoAd = new APSVideoAdRequest(320, 480, Amazon-video-rewarded-slot-ID); rewardedVideoAd.onSuccess += (adResponse) => { MaxSdk.SetRewardedAdLocalExtraParameter(ad-unit-ID, "amazon_ad_response", adResponse.GetResponse()); MaxSdk.LoadRewardedAd(ad-unit-ID); }; rewardedVideoAd.onFailedWithError += (adError) => { MaxSdk.SetRewardedAdLocalExtraParameter(ad-unit-ID, "amazon_ad_error", adError.GetAdError()); MaxSdk.LoadRewardedAd(ad-unit-ID); }; rewardedVideoAd.LoadAd(); } else { MaxSdk.LoadRewardedAd(ad-unit-ID); } } }
Testing Amazon Publisher Services
AppLovin recommends that you enable test mode for Amazon’s SDK to receive test ads. You can do this with the following calls:
Amazon.EnableLogging(true); Amazon.EnableTesting(true);