Advertising: Settings | Setup Audience Network
Importing Facebook Audience Network Plugin
To show ads from Facebook Audience Network you need to import the Facebook Audience Network plugin for Unity. In the FACEBOOK AUDIENCE NETWORK section, click the Download FB Audience Plugin button to open the download page. Download the plugin and import it to your project.
Configuring Facebook Audience Network
After importing Facebook Audience Network plugin, the FACEBOOK AUDIENCE NETWORK section will be updated as below.
Default Placement
Here you can enter the ad IDs to be used with the default placement for each platform. These are the only ad IDs required if you are not using any custom placements in your app. Note that you only need to provide IDs for the ad types you want to use, e.g. if you only use Audience Network banner ads you can leave the interstitial and rewarded ad IDs empty.
To create Audience Network ad units and get the IDs, follow the instructions here.
Custom Placements
Here you can optionally enter the ad IDs associated with non-default ad placements to be used in your app. You can have an arbitrary number of custom placements and can use built-in placements or create new placements for your needs.
Test Mode
To enable test mode, simply check the Enable Test Mode option and enter the test device IDs.
Facebook Audience Network testing instructions can be found here. If your project is still in development, we strongly recommend setting up the testing mode properly to avoid "No fill" error, especially on iOS.
Android device ID
You can find the ID of your test device by importing the Facebook Audience Network SDK for Unity and then building and running the Easy Mobile demo app on that device.
- In Unity, build the Easy Mobile demo app for Android platform
- Install and run the demo app on your testing device
- Open Terminal (Mac) or Cmd (Windows) and type the following command
adb logcat -s AdInternalSettings
(if you're on Windows, you may need to add the Android SDK path to the Windows System PATH)
- In the demo app, click the ADVERTISING button
- Observe the output logcat in the Terminal/Cmd and locate a line similar to the one in the following image which shows your device hash ID
iOS device ID
Follow these steps to find the device ID:
- In Unity, build your project for IOS platform.
- Open the generated project in XCode.
- Open the UnityAppController.mm file.
- Import the FBAudienceNetwork header into that file.
- Add this line [FBAdSettings setLogLevel:FBAdLogLevelLog]; into the init method, before the return statement.
- Run the app on your device and find the ID in the XCode console.
Building Notes
Please follow build instructions here: Android, iOS.
On Android, if you encounter the "Unable to convert classes into dex format" issue when building your game, there might be duplicated files in your project and you need to delete the support-xxx files in the AudienceNetwork folder.