Hi,
I am trying to get my iAd code (which is working perfectly), to fall back to AdMob (using Prime31’s plugin) when there are no ads being served from Apple.
Here’s the code I am using:
#pragma strict
import System.Collections.Generic;
// Bard iAd
var banner:ADBannerView;
function Start () {
// Bard iAd + AdMob + Chartboost
StartCoroutine(ShowBanner());
ChartBoostBinding.showInterstitial( "default" );
AdMobBinding.init( "a1518d4a265caae", true );
}
function Update () {
}
function Awake () {
ChartBoostBinding.cacheInterstitial( "default" );
}
function ShowAdsChartboost () {
ChartBoostBinding.showInterstitial( "default" );
}
// Bard iAd
function ShowBanner() {
banner = new ADBannerView();
banner.autoSize = true;
banner.autoPosition = ADPosition.Bottom;
Debug.Log(banner.error);
while (!banner.loaded && banner.error == null)
yield;
if (banner.error == null)
banner.Show();
else banner = null;
}
I tried changing a part of my ShowBanner function to:
if(banner.error == false) {
banner.Show();
} else if(banner.error == true) {
AdMobBinding.createBanner( AdMobBannerType.iPhone_320x50, AdMobAdPosition.BottomRight );
}
But that didn’t work on the device… Has anyone done this? Would love to get some tips on this.