Hello everyone
I am experiencing a problem which i think is weird. I added admob plugin to the game i am developing and started testing ads.
When the release time came, i removed all the testing code and tested the results on my phone. The ads were visible at this stage.
Then i uploaded the game to play store and installed the game from playstore. Things were looking fine, but suddenly i realised, that the ads were not showing up if installed from play store.
Anyone who might know what could possibly causing such an error? Here is the code
using UnityEngine;
using UnityEngine.UI;
using GoogleMobileAds;
using GoogleMobileAds.Api;
public class BannerAd : MonoBehaviour {
BannerView bannerView;
private bool isLoaded = false;
// Use this for initialization
void Start () {
RequestBanner();
}
void OnDestroy ()
{
if (isLoaded)
bannerView.Destroy();
}
private void RequestBanner()
{
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx";
#elif UNITY_IPHONE
string adUnitId = "";
#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();
bannerView.OnAdLoaded += this.AdLoaded;
// Load the banner with the request.
bannerView.LoadAd(request);
}
public void AdLoaded(object sender, System.EventArgs e)
{
isLoaded = true;
}
}
Thanks in advance