A little Help with Admob Banners.

Hi,

The google dev site makes implementing ads into your game look easy, but for some weird reason I can’t get them to work, no matter what I try, I guess I’m dumb or something.

Right so here’s what I did, Downloaded the latest GoogleMobileAds.unitypackage and imported it into untiy then I slapped this code(below) to a script and slapped the script to a gameobject.
The gameobject was slapped into existence from inside of the heirarchy panel.

using GoogleMobileAds.Api;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AdsScript : MonoBehaviour {

    // Use this for initialization
    void Start () {

        showBannerAd();

    }

    private void showBannerAd()
    {
        string adID = "NOT_SURE_IF_I_SHOULD_SHOW_YOU_GUYS_MY_AD_ID";

        //For testing
        AdRequest request = new AdRequest.Builder()
            .AddTestDevice(AdRequest.TestDeviceSimulator)       // Simulator.
            .AddTestDevice("2077ef9a63d2b398840261c8221a0c9b")  // My test device.
            .Build();

        //For production
        //AdRequest request = new AdRequest.Builder().Build();

        BannerView bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Top);
        bannerAd.LoadAd(request);
    }

    // Update is called once per frame
    void Update () {

    }
}

I’ve tried running it on my phone, a program called nox on my mac and the unity player(not sure if its called the unity player, but it runs your game when you press “Build and Run”).

So please, could someone guide me, it’ll be vvvveeerrrrrryyyy helpful.
Thanks.

I don’t use google ads, but I think if one isn’t available, it doesn’t do anything. You might try out log viewer https://www.assetstore.unity3d.com/en/#!/content/12047 to see if you are getting any console messages once built to a device.

Also, if you keep slapping gameobjects around, they probably don’t want to work. :stuck_out_tongue:

1 Like

Not sure if that’s still relevant, but a few months ago, if you were building for iOS, you had to put the SDK in your Xcode project.

Here’s the latest iOS sdk

Okay I’ll try the Log Viewer, So, Hey, what do you use, I mean, how do you “put” ads in your game?, was it easy?, how’d you do it.

We just use Unity ads and award coins for video views. We still have to check if a video is ready beffore we allow it to be played. Which is what I think google ads does also.