I recently read that Google released a beta for AdMob in WP7 apps. That was great news for developers like me that can’t use Microsoft pubCenter that is US only. So I thought as a first real post here I would write a little tutorial on getting started with the SDK.
Download and install the SDK
First you have to create an account at http://www.admob.com (or login using an existing account) and add a new WP7 app to the AdMob account. You will then be presented with the link to download the AdMob WP7 SDK.
First off, add a reference to “Google.AdMob.Ads.WindowsPhone7.dll” that came with the SDK.
In your XAML file add the following two namespace declaration at the top:
Add the BannerAd control
To add the Ad Control, just add the following piece of code:
<google:BannerAd Name="MyAd" AdUnitID="n50g7fd69132t92" />
The AdUnitID is your Publisher ID presented on the AdMob website. If you run the project you will now get an ad shown. (No that is not my publisher ID )
Run AdMob in test mode
But to avoid getting impression counted while developing the application you might want to use test ads, you can do that by changing the ad code to:
<google:BannerAd Name="MyAd" AdUnitID="n50g7fd69132t92"> <google:BannerAd.TestDeviceIDs> <sys:String> DEVICE_ID </sys:String> </google:BannerAd.TestDeviceIDs> </google:BannerAd>
(I will show how to get the Device ID in my next post.)
And here is the result of our not so hard work.
You are now up and running with Google AdMob in your application! Now go make some money