Export (0) Print
Expand All

Initialize(Game,String)

Updated: August 2, 2013

Published: April 2, 2014

Creates an AdGameComponent object that will manage the DrawableAd objects in your game.

Namespace: Microsoft.Advertising.Mobile.Xna

Assembly: Microsoft.Advertising.Mobile.Xna (in Microsoft.Advertising.Mobile.Xna)

public static void Initialize(
    Game game,
    string applicationId
)

Parameter

Description

Type

game

The Game object that contains the AdGameComponent.

Game

applicationId

The application identifier (ApplicationId) assigned to your game when you registered it with Microsoft pubCenter.

ApplicationId

Exceptions

Exception

Description

System.InvalidOperationExtension

AdGameComponent has already been initialized.

Example

Example method call:

AdGameComponent.Initialize(this, "test_client");
          Components.Add(AdGameComponent.Current);
          textAd = AdGameComponent.Current.CreateAd(…);

Live ads are not available in the emulator. You must use test values for the ApplicationId and AdUnitId when running in the emulator. To verify live ads you will have to run the app on a device. If the ApplicationId is NOT set to the value test_client when the app is running in the emulator, the app will throw an error with the following message. "You can not use pubCenter IDs for testing from the emulator. If you want to test with these IDs please deploy your application to a device. Otherwise please change your ApplicationId to test_client and AdUnitId to one of the supported ad types as outlined in the documentation." For more information see the topic Test Values for AdUnitId and ApplicationId.

Platforms

Windows Phone 7.x only

Support and Feedback

Get product support or report a bug in the product by visiting the Windows Phone Dev Center support page (scroll down to the section "Microsoft Advertising support").

Send feedback about this documentation to adsfdbk@microsoft.com. There is no product support through this alias. Documentation feedback only.

Community Additions

ADD
Show:
© 2015 Microsoft