- Home /
iAd fallback to AdMob
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.
Okay, thanks for answering. I am trying to decide between different options and also felt iAd with Ad$$anonymous$$ob fallback seems like the best solution. Good to hear you got it working.
Answer by hellobard · Jul 31, 2013 at 12:20 PM
yeah, but not with this script. I just bought the AdMob plugin from Prime31 for unity. works great and it will serve iAds, Google Ads, etc. with a control over which is served first from the AdMob website.
Answer by psycocrusher · Oct 01, 2014 at 05:26 PM
You can do that directly from admob's portal. You click edit mediation, and you give a higher value to iads.
Your answer
Follow this Question
Related Questions
Is there a way to tell if show iAd failed (with prime31 iOS Plugin) 0 Answers
Can I modify codes using Xcode after creating the app using Unity3d? 1 Answer
IAds Banner help. If IAds isn't showing show admob. 1 Answer
Tapping iAd via AdMob is triggering RANDOM clicks on sprites in my scene. 1 Answer
Why Admob Ad not Showing in Amazon Kindle Fire device? 1 Answer