Hey I have recently integrated AdMob in my Unity game project when I open my app in my phone it show me ad for 0.5 second and then disappears but the area remain clickable on clicking it behave like ad but not showing.
Note: This is working perfectly in my editor but making issues in real device.
I have created a Ad Manager project with this code
using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
using System.Collections.Generic;
public class Banner : MonoBehaviour
{
private BannerView bannerView;
void Start()
{
// Initialize Google Mobile Ads SDK
MobileAds.Initialize(initStatus => { });
// Load and show the banner ad
StartCoroutine(ShowBannerWithDelay(3f));
}
IEnumerator ShowBannerWithDelay(float delay)
{
// Wait for the specified amount of time
yield return new WaitForSeconds(delay);
// Show the banner ad
// Create the banner ad at the bottom of the screen
bannerView = new BannerView("XXXXXXXXX", AdSize.Banner, AdPosition.Bottom);
// Create the ad request
AdRequest request = new AdRequest();
bannerView.LoadAd(request);
}
public void HideBanner()
{
if (bannerView != null)
{
// Hide the banner ad
bannerView.Hide();
}
}
void OnDestroy()
{
// Destroy the banner when the object is destroyed
if (bannerView != null)
{
HideBanner();
bannerView.Destroy();
bannerView = null; // Clean up the reference
}
}
}
It re loads ad on game restart 🙂
I have tried to implement AdMob ads but im getting hidden ads.
5