Question by
Deadshot1994 · Dec 02, 2015 at 11:05 AM ·
adsadmobadvertising
Help with AdMob interstitials
Hi guys I am looking for someone who can help me with this problem: I have this code
private const string AD_UNIT_ID = "***********";
private const string INTERSTITIAL_ID = "**********";
private AdMobPlugin admob;
public bool hidden = true;
void Awake(){
DontDestroyOnLoad (this);
}
// Use this for initialization
void Start () {
admob = GetComponent<AdMobPlugin> ();
admob.CreateBanner (AD_UNIT_ID, AdMobPlugin.AdSize.SMART_BANNER, false, INTERSTITIAL_ID);
admob.RequestAd ();
admob.HideBanner ();
admob.RequestInterstitial ();
}
// Update is called once per frame
void Update () {
}
public void BannerS(){
admob.ShowBanner();
hidden = false;
}
public void OnEnable(){
AdMobPlugin.InterstitialLoaded += HandleInterstitialLoaded;
}
public void OnDisable(){
AdMobPlugin.InterstitialLoaded -= HandleInterstitialLoaded;
}
public void HandleInterstitialLoaded ()
{
admob.ShowInterstitial ();
}
public void OnIntClosed(){
AdMobPlugin.InterstitialClosed += OnAdClosed;
}
public void OnAdClosed(){
admob.RequestAd ();
}
So my question is: in my game the interstitial ad displays just once, how do I make interstitials show up when I tell them to? For example I have this IEnumerator which I call when something is pressed:
IEnumerator WaitForSecond(){
yield return new WaitForSeconds (0.8f);
GameObject.Find ("AdMobControl").GetComponent<AdMobTest1> ().HandleInterstitialLoaded ();
Debug.Log("Intestitial Shown");
}
Thanks!
Comment
Your answer
Follow this Question
Related Questions
Error, platform-specific implementation not set // AdColony Unity 0 Answers
How to make an Ad Repeat after 5minutes iOS 0 Answers
Destroy an Object through rewarded video. 0 Answers
Google Admob not showing interstitial ads on apk build 0 Answers
Admob new rewarded video api causing a memory leak?,Admob new rewarded ad api causing a memory leak 0 Answers