I just launched my app called Dodge: the Game to android and iOS, when testing the ads were working on iOS. When launching the game to both platforms there were no ads on android and in the Admob dashboard there are no requests. When there are for iOS.
This is the code I am using to call ads:
using UnityEngine;
using UnityEngine.SceneManagement;
using GoogleMobileAds;
using GoogleMobileAds.Api;
public class Menu : MonoBehaviour {
private BannerView bannerView;
private void Awake()
{
SetupAds();
}
void SetupAds()
{
if (PlayerPrefs.HasKey("AdFree"))
return;
#if UNITY_IPHONE
string appId = "ca-app-pub-9468963556585973~6866139959";
#elif UNITY_ANDROID
string appId = "ca-app-pub-9468963556585973~5324184926";
#else
sting appId = "unexpected_platform";
#endif
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(appId);
this.RequestBanner();
}
private void RequestBanner()
{
#if UNITY_IPHONE
string adUnitId = "ca-app-pub-9468963556585973/6704565848";
#elif UNITY_ANDROID
string adUnitId = "ca-app-pub-9468963556585973/7268247018";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}
public void StartGame ()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
public void DisableAds()
{
Debug.Log("Ads disabled");
if (PlayerPrefs.HasKey("AdFree"))
print("Ads already removed");
else{
PlayerPrefs.SetInt("AdFree", 1);
PlayerPrefs.Save();
bannerView.Destroy();
}
}
}