We provide a method to enable test ads for a (or multiple) IDFAs/GAIDs programmatically in the AppLovin SDK.
NOTE: With Test Ads enabled impressions, clicks, and revenue will not be tracked. This should only be used to test your app integration.
AppLovin SDK
Native Android
Test ads can be enabled for a set of IDFAs by setting the testDeviceAdvertisingIds property that is part of the settings object of the SDK to a list that includes the IDFAs. The following are code snippets for Java and Kotlin.
Java
AppLovinSdk.getInstance(context).getSettings().setTestDeviceAdvertisingIds(Arrays.asList("YOUR_GAID_HERE"));
Kotlin
AppLovinSdk.getInstance(context).settings.testDeviceAdvertisingIds = arrayListOf("YOUR_GAID_HERE")
Native iOS
Test ads can be enabled for a set of IDFAs by setting the testDeviceAdvertisingIds property that is part of the settings object of the SDK to an array that includes the IDFAs. The following are code snippets for Swift and Objective-C.
Swift
ALSdk.shared()!.settings.testDeviceAdvertisingIdentifiers = ["YOUR_IDFA_HERE"]
Objective-C
[ALSdk shared].settings.testDeviceAdvertisingIdentifiers = @[@"YOUR_IDFA_HERE"];
Unity (MAX Plugin)
If you are on the AppLovin MAX Unity Plugin, test ads can be enabled by providing an array of IDFAs to a method on the MaxSdk class.
MaxSdk.SetTestDeviceAdvertisingIdentifiers(new string[]{"YOUR_IDFA_HERE", "YOUR_GAID_HERE"});
Unity (AppLovin Plugin)
If you are on the AppLovin network Unity Plugin, test ads can be enabled by providing an array of IDFAs to a method on the AppLovin class.
AppLovin.SetTestDeviceAdvertisingIdentifiers(new string[]{"YOUR_IDFA_HERE", "YOUR_GAID_HERE"});
Troubleshooting
If you are not able to get test ads after following these steps, you might have an integration issue. Please follow the other steps in our support article titled "Why am I not seeing any ads?".