Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Admob interstitial suddenly disappear after showing

$
0
0
Hi, I have following code for my iOS game I just integrating it in an empty scene public class AdController : MonoBehaviour { void Start() { print ("------------------ initializing ads --------------------"); #if UNITY_ANDROID string appId = "ca-app-pub-xxxxxxxxxxxxxxxxx~xxxxxxxxxxxxxx"; #elif UNITY_IPHONE string appId = "ca-app-pub-xxxxxxxxxxxxxxxxxx~xxxxxxxxxxxxx"; #else string appId = "unexpected_platform"; #endif // Initialize the Google Mobile Ads SDK. MobileAds.Initialize (appId); RequestInterstitial(); } private InterstitialAd interstitial; private void RequestInterstitial() { print ("----------- RequestInterstitial -------------"); #if UNITY_ANDROID string adUnitId = "ca-app-pub-xxxxxxxxxxxxxxxxxxxx"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxx"; #else string adUnitId = "unexpected_platform"; #endif this.interstitial = new InterstitialAd(adUnitId); // Called when an ad request has successfully loaded. this.interstitial.OnAdLoaded += HandleOnAdLoaded; // Create an empty ad request. AdRequest request = new AdRequest.Builder(). AddTestDevice("xxxxxxxxxxmydevicexxxxxxxxxxx") .Build(); // Load the interstitial with the request. this.interstitial.LoadAd(request); } public void HandleOnAdLoaded(object sender, EventArgs args) { print("HandleAdLoaded event received"); showInterstitial (); } void showInterstitial() { if (this.interstitial.IsLoaded ()) { this.interstitial.Show (); } else { print ("ad not ready yet"); } } } After my ads shows for 1 second and then it disappears automatically. Here is video link for explaining my problem [https://www.dropbox.com/s/kvrjew0cr8ayqzo/LDFA2437.MP4?dl=0][1] Anything I am doing wrong? [1]: https://www.dropbox.com/s/kvrjew0cr8ayqzo/LDFA2437.MP4?dl=0

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>