简体   繁体   中英

Admob mediation with unity ads in Unity3D not display Unity Ads only AdMob Ads

I was implemented AdMob Mediation with Unity Ads in Unity3D.

I completely added Unity Ads in AdMob Mediation Network, but my app won't showing ads from Unity Ads, it's showing ad from AdMob only.

What I am missing in my script? below is my script.

    using System;
    using UnityEngine;
    using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;
using GoogleMobileAds;
using GoogleMobileAds.Api;
using UnityEngine;
using UnityEngine.Advertisements;

public class UIManager : MonoBehaviour
{
    //AdMob
    private InterstitialAd interstitial;
    //End
}
void Awake()
{
    RequestInterstitial ();
}
private void RequestInterstitial()
{
    #if UNITY_EDITOR
    string adUnitId = "unused";
    #elif UNITY_ANDROID
    string adUnitId = "ca-app-pub-250631676/1043270594";
    #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
    string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
    #else
    string adUnitId = "unexpected_platform";
    #endif

    // Create an interstitial.
    interstitial = new InterstitialAd(adUnitId);
    // Register for ad events.
    interstitial.OnAdLoaded += HandleInterstitialLoaded;
    interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
    interstitial.OnAdOpening += HandleInterstitialOpened;
    interstitial.OnAdClosed += HandleInterstitialClosed;
    interstitial.OnAdLeavingApplication += HandleInterstitialLeftApplication;
    // Load an interstitial ad.
    interstitial.LoadAd(createAdRequest());
}
private void ShowInterstitial()
{
    if (interstitial.IsLoaded())
    {
        interstitial.Show();
    }
    else
    {
        print("Interstitial is not ready yet.");
    }
}
//Unity Ads
public void ShowAd()
{
    if (Advertisement.IsReady())
    {
        Advertisement.Show();
    }
}
//End 

private AdRequest createAdRequest()
{
    return new AdRequest.Builder ().Build ();
}

Thank you so much for your help.

Admob mediation works in this way

  • If ad is not available in that particular region and at that point of time, then only it will check for the next mediated network and it will show that ad.

  • The main thing here is AdMob gives priority to itself, so u will only see AdMob every time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM