Alex Shkor
Alex Shkor

Reputation: 1209

XNA AdGameComponent does not draw

I have following code. But AddGameComponent doesn't draw.

   protected override void Initialize()
    {
        // TODO: Add your initialization logic here
        base.Initialize();
        var li = new LicenseInformation();
        IsTrial = li.IsTrial();
        if (IsTrial)
        {
            AdGameComponent.Initialize(this, AppID);
            Components.Add(AdGameComponent.Current);
            CreateAd();
        }
    }


   private void CreateAd()
    {
        bannerAd = AdGameComponent.Current.CreateAd(AdUnitID, new Rectangle(x, y, width, height), true);
        AdGameComponent.Current.Enabled = true;
    }

I have tried to set DrawOrder to 1000, but ads still doesn't work.

Upvotes: 0

Views: 568

Answers (2)

Alex Shkor
Alex Shkor

Reputation: 1209

Answer: Ads needed geo-location data.

this.gcw = new GeoCoordinateWatcher(); 
this.gcw.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(gcw_PositionChanged); 
this.gcw.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(gcw_StatusChanged); 
this.gcw.Start(); 

Upvotes: 0

Kolky
Kolky

Reputation: 2977

You should call the corresponding Draw and Update methods from the AdGameComponent, see the documentation: http://msdn.microsoft.com/en-us/library/hh495436(v=MSADS.20).aspx

Upvotes: 2

Related Questions