- Home /
Question by
Bhargav5530 · Aug 21, 2015 at 10:19 AM ·
banner
How can I check banner ad is loaded and is displaying or not
Hello unity users,
I am using Google Admob in my game. The banner ad is showing successfully in my game. I am displaying banner at the top of the screen. Now my requirement is how can I check the banner is displaying to the user or not. How can I achieve this type of functionality.
Here is my code for display banner.
using UnityEngine;
using System.Collections;
using GoogleMobileAds;
using GoogleMobileAds.Api;
public class AdTop : MonoBehaviour {
public BannerView bannerView;
void Awake ()
{
if (PlayerPrefs.GetInt ("Ad") != 1) {
bannerView = new BannerView ("ca-app-pub-6996012155310080/6632284250", AdSize.SmartBanner, AdPosition.Top);
AdRequest request = new AdRequest.Builder ().Build ();
bannerView.LoadAd (request);
}
}
}
Can anyone help me..?
Comment
Best Answer
Answer by Ekta-Mehta-D · Aug 21, 2015 at 10:22 AM
hii..
you will be having ad events.
public void HandleAdLoaded(object sender, EventArgs args)
{
print("HandleAdLoaded event received.");
}
This will handle your event . you can check here ad is loaded or not.
Its give "EventArgs does not exist in current context" error
Use 'System.EventArgs args' instead of 'EventArgs args'. It worked for me.
Your answer
