AdMob ad wont refresh/load new ads.

628 views
Skip to first unread message

Rakin Alam

unread,
Jun 1, 2014, 3:49:35 AM6/1/14
to google-adm...@googlegroups.com
Hi,

So I have used google admob plugin for unity for my game. On the google admob apps page i set it to refresh every 50 second. But when I am playing the game, the ads won't refresh unless I restart the game. Also I see the same 3 or 4 ads every time.

here is my code:

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

public class AdControl : MonoBehaviour {
public string ad_unit_id = "mt app unit id";

// The ad banner display object.
BannerView bannerView;

// Update is called once per frame
void Start () {
// Create a smart banner at the bottom of the screen.
bannerView = new BannerView(
ad_unit_id, AdSize.SmartBanner, AdPosition.Bottom);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder()
.Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}

void Update() {
if (Game.stateElapsedFrames == 1) {
// Let's not show the ad during gameplay, so the player doesn't
// get distracted.  Showing ad on title screen may be bad for
// the public view of the company.
if (Game.state == Game.State.GameOver) {
bannerView.Show();
} else {
bannerView.Hide();
}
}
}
}

Eric Leichtenschlag

unread,
Jun 2, 2014, 9:48:05 PM6/2/14
to google-adm...@googlegroups.com
The code here looks good and ads should refresh if your ad unit has a refresh rate set up. You can check the logs (logcat on Android, or logs within XCode on iOS) and see some Ads related logs firing when a refresh occurs. You could also listen for the AdLoaded event inside Unity to confirm for yourself:

bannerView.AdLoaded += delegate(object sender, EventArgs args)
{
   
print("Banner loaded");
};



As far as seeing the same ads, that depends on what inventory is available from the network and what AdMob thinks is the highest paying ad to serve. You don't have much control over what serves - the only thing you can do is apply filters to what can't return, but that only limits your inventory set.

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages