Hello for a few days now I have been trying to put Google Admob ads in my Android games. I do get all the dummy logs that says the ads work, but the ads never show, in the editor, using build and run, or when building and copying the apk file to my phone.
Here's my code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
using System;
public class AdScript : MonoBehaviour
{
private BannerView bannerView;
void Start()
{
string appID = "(my app ID)";
MobileAds.Initialize(appID);
this.RequestBanner();
}
private void RequestBanner()
{
string adBannerID = "(test banner ID";
bannerView = new BannerView(adBannerID, AdSize.Banner, AdPosition.Bottom);
AdRequest adRequest = new AdRequest.Builder().Build();
bannerView.LoadAd(adRequest);
bannerView.Show();
}
}
(I changed the ID, but don't worry I used the real ID in my code)
Thanks a lot for any help I can get, I've been stuck on this for nearly a week now ! :)
↧