Audience Network

Test Your Implementation on a Test Device

Updated: Jun 30, 2026
Copy for LLM
To test your Audience Network implementation on the client-side, you temporarily insert code into your app. This code allows you to test production ads on your physical devices before releasing your app to the public. This testing allows you to test any type of ad; a carousel ad, an image ad, or a landscape or portrait video ad.

Requirements

To request a test ad, you will use the following test ad type string to concatenate the placement ID with ‘#’ when initializing any Facebook ad object. The placement ID template for requesting test ads is TEST_AD_TYPE#YOUR_PLACEMENT_ID.
You should never ship your app to the public with the above test code as it will cause only test ads to be shown. You should instead use a preprocessor macro such as DEBUG or TESTING and then use #ifdef to distinguish a test build from a release build.

Test Ad Types

Test Ad Type Description Supported Ad Format
CAROUSEL_IMG_SQUARE_APP_INSTALL
carousel ad with square image and app install CTA option
Interstitial, Native
CAROUSEL_IMG_SQUARE_LINK
carousel ad with square image and link CTA option
Interstitial, Native
IMG_16_9_APP_INSTALL
16x9 image ad with app install CTA option
Banner, Interstitial, Native
IMG_16_9_LINK
16x9 image ad with link CTA option
Banner, Interstitial, Native
PLAYABLE
Playable ad with app install CTA option
Interstitial, Rewarded Video
VID_HD_9_16_39S_APP_INSTALL
9x16 HD video 39 sec ad with app install CTA option
Interstitial, Native, Rewarded Video
VID_HD_9_16_39S_LINK
9x16 HD video 39 sec ad with link CTA option
Interstitial, Native, Rewarded Video
VID_HD_16_9_15S_APP_INSTALL
16x9 HD video 15 sec ad with app install CTA option
Interstitial, Native, Rewarded Video
VID_HD_16_9_15S_LINK
16x9 HD video 15 sec ad with link CTA option
Interstitial, Native, Rewarded Video
VID_HD_16_9_46S_APP_INSTALL
16x9 HD video 46 sec ad with app install CTA option
Interstitial, Native, Rewarded Video
VID_HD_16_9_46S_LINK
16x9 HD video 46 sec ad with link CTA option
Interstitial, Native, Rewarded Video
Be sure the format of the ad you are requesting is supported by the test ad type or you will get a Code=1011 "Display Format Mismatch" error.

iOS Device Testing

To test a native ad on your iOS device, you can initialize an FBNativeAd object.

Sample Code

The following sample requests a video test ad with a 9:16 aspect ratio and an app install CTA button.
[FBNativeAd *nativeAd = [[FBNativeAd alloc] initWithPlacementID:@"VID_HD_9_16_39S_APP_INSTALL#{your-placement-id}"];
When testing your app with Facebook ad units, you must specify the device hashed ID to ensure the delivery of test ads.
#ifdef DEBUG
[FBAdSettings setLogLevel:FBAdLogLevelLog];
[FBAdSettings addTestDevice:@"{hashed-id}"];
#endif
You can run the above code, substituting {your-placement-id} with your placement ID and {hash-id} with your test device hash ID, to request a test ad in the NativeAdSample project from the Audience Network SDK sample folder.
NativeAdSample app on iOS showing a Facebook test ad with an Install Now button, confirming the integration works
After you have finished testing you should clear the test device setting.

Sample Code

[FBAdSettings clearTestDevice:[FBAdSettings testDeviceHash]];

Android Testing

To test a native ad on your Android device, you can initialize a NativeAd object.

Sample Code

The following sample requests a video test ad with a 9:16 aspect ratio and app install CTA button.
nativeAd = new NativeAd(this, "VID_HD_9_16_39S_APP_INSTALL#{your-placement-id}");
You can run the above code, substituting {your-placement-id} with your placement ID.
Get the test device hashed ID from the Logcat. The log will look like the following:
Log: When testing your app with Facebook's ad units you
must specify the device hashed ID to ensure the delivery
of test ads, add the following code before loading an ad: `AdSettings.addTestDevice("{hashed-id}");`
Then, enable test ads on a device by adding the following line of code before loading an ad:
AdSettings.addTestDevice("{hashed-id}");
If you wish to add multiple test devices, then create a list of strings to be added before loading an ad.
List<String> testDevices = new ArrayList<>();
testDevices.add("{hashed-id-1}");
testDevices.add("{hashed-id-2}");
AdSettings.addTestDevices(testDevices);
When you are finished testing you should clear the test device setting using this line of code:
AdSettings.clearTestDevices();

Mediation Dashboard

In addition to requesting the test ad from code, you can configure the placement ID value with test ad type from your mediation dashboard if your app uses mediation. For example, if your app uses MoPub, you can edit Facebook network and set the placement ID value for the native ad to be VID_HD_9_16_39S_APP_INSTALL#{your-placement-id}. Your app will receive a video test ad with a 9:16 aspect ratio and app install CTA button.
Mediation dashboard Set up Facebook inventory table mapping app ad units to test ad type placement IDs

Learn More