Windows Phone 8.0 Silverlight Apps -- Integrating the AdControl Using the Visual Designer
Updated: April 1, 2014
Published: April 2, 2014
The following steps are a guide to using the Visual Studio 2012 Visual Designer to integrate advertising into apps targeting Windows Phone 8.0.
Integrate an AdControl into an App Using the Visual Studio 2012 Visual Designer
Open Visual Studio and create a new project.
From the installed templates section (on the left), expand Visual C# and click Windows Phone.
Select the type of application you are building—for example, Windows Phone App.
Name the project (for example, AdControlTest) or accept the default name and click OK.
Next, you will need to verify and add the required capabilities to your app.
In the Solution Explorer panel, open the Properties node. Then double click WMAppManifest.xml.
Click the Capabilities tab. In this panel, make sure the ID_CAP_IDENTITY_USER, ID_CAP_MEDIALIB_PHOTO, and ID_CAP_PHONEDIALER are checked. If not, add those by clicking on the check box. Do not uncheck the other capabilities, your app will not run if you do.
The addition of required capabilities for seeing test ads in the emulator is new with updated versions of Visual Studio 2012. Older versions may not have required this step to run. Follow these steps to double-check you have the required capabilities.
In the Toolbox, you will see the AdControl in the Windows Phone Controls tab.
Drag and drop the AdControl into the Application Designer. Position the AdControl so that it is fully visible in the Application Designer.
If you look at the code behind file for the page hosting the AdControl, you can see the code inserted by the AdControl.
Expand the AdControl properties in the Visual Studio Properties panel.
Take a moment to examine the AdUnitId and ApplicationId properties. By default the following properties are set to the following values.
AdUnitId is Image480_80.
ApplicationId is test_client.
To receive live ads on a device you will replace these values with the values for your app id and ad unit id from Microsoft pubCenter. For more information about test values, see Test Values for AdUnitId and ApplicationId.
Run your application and you will see a sample test ad.
It may take several minutes, depending on the speed of your machine, for the emulator to load and then for the application to be deployed. Once the app is deployed you will see the sample test ad in a sample app. Watch the text in the Visual Studio 2012 Status Bar to see the progress.
Live ads will not display in the emulator.
In order to receive live ads in the app you submit to the store you will need to replace the test values of the AdControl with the live values from pubCenter. For more information, see Getting Access to Microsoft pubCenter and Receiving Ads.
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 firstname.lastname@example.org. There is no product support through this alias. Documentation feedback only.