Audience Network is now bidding only
Audience Network is now only using bidding to fill ads in iOS and Android apps. You’ll need to move your apps from waterfall to bidding to monetize with Audience Network.
Read more on our Audience Network blog post.
Meta Audience Network allows you to monetize your Android apps with Facebook ads. This guide will walk you through all the steps to integrate the SDK.
Ensure that you have Android Studio installed.
Please see the FAQ for minimum OS version supported by Audience Network SDK.
You can skip this step if you already have a project you want to integrate Audience Network into.
Start Android Studio and select "Start a new Android Studio Project"
Name your project and specify your company's domain.
The Package name will be your identifier if you decide to upload your app to the Google Play store.
Set your minimum Android SDK version. Audience Network requires API 15
or higher, but for the sake of
these samples, we will use API 21
.
Add an Empty Activity to your Project
Name your initial Activity and click Finish.
The Audience Network SDK is part of the Facebook SDK. Follow these steps to download and include it in your project:
Add the following compile statement to your app-level build.gradle (not project!), to use the latest Audience Network SDK:
dependencies { compile 'com.facebook.android:audience-network-sdk:6.+' }
If there are issues resolving the Audience Network SDK, make sure that you've synced your Gradle file and try restarting Android Studio.
If using Intellij IDEA or Eclipse, download and extract the Audience Network SDK for Android. Under the AudienceNetwork/bin
folder, copy the AudienceNetwork.aar
file and place it in the /libs
folder in your project you might need to create the directory if it doesn't already exist. Then, add the following lines to your app's build.gradle:
repositories { flatDir { dirs 'libs' } } dependencies { ... compile(name: 'AudienceNetwork', ext: 'aar') }
If using AudienceNetwork.jar
for your project, under the AudienceNetwork/bin
folder, rename the AudienceNetwork.aar
to AudienceNetwork.zip
, extract classes.jar
file and rename it to AudienceNetwork.jar
, place the AudienceNetwork.jar
file in the /libs
folder in your project you might need to create the directory if it doesn't already exist. Make sure your IDE's UI reflects this change. If you are using Intellij IDEA or Eclipse, right click on the libs/AudienceNetwork.jar
file and choose 'Add as Library'.
Though not required, we recommend that you set up your project to work with Google Play Services as indicated here. This will enable the Audience Network SDK to fetch the Advertising ID more efficiently.
When integrating the Audience Network SDK, the integration error mode setting can be used to verify that your integration is working as intended. Specifically, this method allows you to control the SDK's behavior when used incorrectly .
INTEGRATION_ERROR_CRASH_DEBUG_MODE
: App will crash if your build has Android FLAG_DEBUGGABLE, otherwise INTEGRATION_ERROR_CALLBACK_MODE
will be used (recommended when testing). INTEGRATION_ERROR_CALLBACK_MODE
: App will call AdListener.onError(Ad, AdError)
callback if an integration error is discovered.// Example for setting the SDK to crash when in debug mode AdSettings.setIntegrationErrorMode(INTEGRATION_ERROR_CRASH_DEBUG_MODE);
Relevant code samples in both Swift and Objective-C are available on our GitHub sample app respository
Test your ads integration with your app.
As soon as we receive a request for an ad from your app or website, we'll review it to make sure it complies with Audience Network policies and the Facebook community standards