Audience Network is bidding only
Audience Network exclusively uses bidding to serve ads in iOS and Android apps.
Make sure you have Android Studio installed.
Please see the FAQ for minimum OS version supported by Audience Network SDK.
Java and Kotlin code samples are available in our GitHub repository.
If you already have an existing project where you want to integrate Audience Network, you can skip this step.
Open Android Studio and select New Project.
Select a Empty Activity to add it to your project and then click Next.
Give your project a name and provide your company's domain. The Package name serves as your app's unique identifier if you choose to publish it on the Google Play Store.
Configure the minimum Android SDK version. Audience Network requires API 24 or higher.
The Audience Network SDK is bundled as part of the Facebook SDK. Complete the following steps to download and add it to your project:
Add the following implementation statement to your app-level build.gradle file (not the project-level one) to pull in the latest Audience Network SDK:
dependencies {
implementation 'com.facebook.android:audience-network-sdk:6.+'
}If you encounter issues resolving the Audience Network SDK, verify that your Gradle file is synced and try restarting Android Studio.
Download and extract the Audience Network SDK for Android. Navigate to the AudienceNetwork/bin folder, copy the AudienceNetwork.aar file, and place it in the /libs folder within your project. You may need to create this directory if it does not already exist. Then, add the following lines to your app's build.gradle:
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
...
implementation(name: 'AudienceNetwork', ext: 'aar')
}The Audience Network SDK depends on Google Play Services (play-services-ads-identifier and play-services-basement) to retrieve the Advertising ID. Make sure your project is configured to use Google Play Services as described here.
During Audience Network SDK integration, the integration error mode setting helps you verify that your implementation is working correctly. This method gives you control over how the SDK behaves when it detects incorrect usage.
INTEGRATION_ERROR_CRASH_DEBUG_MODE: The app crashes if your build has the Android FLAG_DEBUGGABLE flag set. Otherwise, INTEGRATION_ERROR_CALLBACK_MODE is used instead (recommended during testing).INTEGRATION_ERROR_CALLBACK_MODE: The app invokes the AdListener.onError(Ad, AdError) callback whenever an integration error is detected.// Example for setting the SDK to crash when in debug mode AdSettings.setIntegrationErrorMode(INTEGRATION_ERROR_CRASH_DEBUG_MODE);
Once your app has a link, you can configure Audience Network in Monetization Manager to get ad format placement IDs.
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