'Facebook Audience Network Bidding integration in Android

I hope many of you are using Facebook Audience Network for app monetization. I am having some questions regarding their latest new "bidding" strategy.

I want to integrate AdMob as a mediation partner with Facebook Audience Network. After reading the documentation mentioned, it seems like I have to add both (AdMob + FAN) SDK's and make ad requests separately from both of these. Can someone please confirm for me if that is true? Does that mean if I want to integrate multiple mediation partners I'll have to add multiple SDKs? Don't you think it will increase the app size unnecessarily?

Please share your thoughts if any of you have implemented Bidding in their Android App.

Thank You



Solution 1:[1]

You have to add FAN mediation sdk and google admob sdk. You don't have to request ads for Facebook audiences network just initialize the audience network sdk.. Make sure that you have added Facebook audiences network placement as an ad source in Admob oepn bidding section.

Solution 2:[2]

I am thinking to add facebook audience network to my app and came across your question. Have you get the answer yet?

Solution 3:[3]

NOTE : Use Real Ads Id and Configure your Mobile Device on Admob and Facebook Dashboard

1 —> add dependancies to buid.gradle (App)

if your sdk version is below 31 



 //    admob
    implementation 'com.google.android.gms:play-services-ads:20.4.0'
    //facebook mediation
    implementation 'com.google.ads.mediation:facebook:6.8.0.0'

If your sdk version is 31 or above

  //    admob
    implementation 'com.google.android.gms:play-services-ads:20.6.0’
    //facebook mediation
    implementation 'com.google.ads.mediation:facebook:6.8.0.1’

2 —> Configure your app

buildscript {
    repositories {
        google()
        mavenCentral()
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

3 —> Add meta tag to manifest

 <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>

4 —> Initialise ads

    MobileAds.initialize(this, new OnInitializationCompleteListener() {
  @Override
  public void onInitializationComplete(InitializationStatus initializationStatus) {

  }
});

    AdSettings.addTestDevice("ID”);//
    
    MobileAds.setRequestConfiguration(
            new RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("ID"))
                    .build());//

5—> for Testing Check which ad network adapter class loaded the ad

public void onAdLoaded() {
  Log.d("Banner adapter class name: " + ad.getResponseInfo().getMediationAdapterClassName());
}

6 —> Additional code required

In manifest

android:networkSecurityConfig="@xml/network_security_config"

network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
</domain-config>
</network-security-config>

7 —> Test your implementation using mediation Test Suite

Add dependenceis to

implementation 'com.google.android.ads:mediation-test-suite:2.0.0'

Include the google() repository in your top-level build.gradle file:

If not there —————————————————————  

repositories {
       google()
       jcenter()
   }

———————————————————————

allprojects {
   repositories {
       google()
       jcenter()
   }
}

Launch using below code

MediationTestSuite.launch(MainActivity.this);

8 —> Test Ids

<string name="app_id">ca-app-pub-3940256099942544~3347511713</string>
<string name="app_open_id">ca-app-pub-3940256099942544/3419835294</string>

<string name="banner_preview">ca-app-pub-3940256099942544/6300978111</string>
<string name="banner_my_creation">ca-app-pub-3940256099942544/6300978111</string>
<string name="banner_extract">ca-app-pub-3940256099942544/6300978111</string>
<string name="banner_main">ca-app-pub-3940256099942544/6300978111</string>

<string name="interstitial_my_creation">ca-app-pub-3940256099942544/1033173712</string>
<string name="interstitial_save">ca-app-pub-3940256099942544/1033173712</string>

<string name="native_main">ca-app-pub-3940256099942544/2247696110</string>
<string name="native_preview">ca-app-pub-3940256099942544/2247696110</string>

<string name="ad_attribution">Ad</string>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user12680031
Solution 2 samcooke
Solution 3 Vinesh Chauhan