- Home /
Question by
pusanknife · Nov 23, 2021 at 03:29 AM ·
ads
admob ads not working on android
admob ads godd working in unity
but when I builded it, not working on android
what's the problem?(device or C# code or computer)
I really really don't know ~~ plz reply god answer~~below my C# code
using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api;
public class BottomBanner : MonoBehaviour { private BannerView bannerView;
public void Start()
{
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(initStatus => { });
this.RequestBanner();
}
private void RequestBanner()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
string adUnitId = "unexpected_platform";
#endif
// Clean up banner ad before creating a new one.
if (this.bannerView != null)
{
this.bannerView.Destroy();
}
AdSize adaptiveSize =
AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(AdSize.FullWidth);
this.bannerView = new BannerView(adUnitId, adaptiveSize, AdPosition.Bottom);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
this.bannerView.LoadAd(request);
}
}
Comment
Your answer
Follow this Question
Related Questions
how to add banner in game unity ads? 0 Answers
How to show and hide ads, using admob. 1 Answer
TAX info problem 1 Answer
unity wont recompile when using ads 0 Answers