Unity still showing test ads in production version.

I made an app that is currently active in the Play Store, checked "Force test mode OFF (i.e. use real ads) for all devices" and unchecked "enable test ads" in the unity service window. Also, the ad banner never appeared, I don't know if it's because I did a wrong implementation, thanks in advance.

This is my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;


public class adv: MonoBehaviour
{
    string gameId = "xxxxxxx";
    bool testMode = false;
    public string placementId = "bannerPlacement";
    public string placementIds = "video";

    void Start()
    {
        Advertisement.Initialize(gameId, testMode);

        StartCoroutine(ShowBannerWhenReady());  
    }

    void Update()
    {
        if (PlayerPrefs.GetFloat("ADV") >= 10)
        {

            ShowInterstitialAd();

            PlayerPrefs.SetFloat("ADV", 0);
        }
    }
    public void ShowInterstitialAd()
    {
        if (Advertisement.IsReady(placementIds))
        {
            Advertisement.Show(placementIds);          
        }
        else
        {
            Debug.Log("Interstitial ad not ready at the moment! Please try again later!");
        }
    }
    IEnumerator ShowBannerWhenReady()
    {
        while (Advertisement.IsReady(placementId))
        {
            yield return new WaitForSeconds(0.5f);
        }
        Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER);
        Advertisement.Banner.Show(placementId);
    }

    public void OnUnityAdsDidFinish(string placementIds, ShowResult showResult)
    {

        if (showResult == ShowResult.Failed)
        {
            ShowInterstitialAd();
        }

    }

}

Sadly this is a very common mistake. There are two different ways you can disable testMode in your application.

The first method will require you to do another build, to do this you must locate the testMode toggle in the services window and disable it, then you must pass through the false boolean for testMode in your Advertisement.Intitialize() function. Also if your testMode variable is a public variable, or serializable, ensure that it is also set to false in the inspector panel.

The second method will not require you to do a new build however it will disable testMode regardless of what boolean you pass to the SDK. To do this you will need to go to your project in your Unity Dashboard > Project Settings > TestMode, set this to 'Override Client Test Mode' and then 'Force Test Mode OFF'. This will force testMode off on all builds of your app regardless of the settings in your code.

2 Likes

[quote=“Unity_Adamski”, post:2, topic: 831457]
Sadly this is a very common mistake. There are two different ways you can disable testMode in your application.

The first method will require you to do another build, to do this you must locate the testMode toggle in the services window and disable it, then you must pass through the false boolean for testMode in your Advertisement.Intitialize() function. Also if your testMode variable is a public variable, or serializable, ensure that it is also set to false in the inspector panel.

The second method will not require you to do a new build however it will disable testMode regardless of what boolean you pass to the SDK. To do this you will need to go to your project in your Unity Dashboard > Project Settings > TestMode, set this to ‘Override Client Test Mode’ and then ‘Force Test Mode OFF’. This will force testMode off on all builds of your app regardless of the settings in your code.
[/quote]
Thank you very much, solved like a charm!