I am trying to integrate ads into a already successful deployed app. However no matter what I do, I cannot seem to get the ads working. I have tried using both the code vers
I think your problem could come from (if you didn't remove it for posting it here):
<my:AdControl AdUnitId="Image480_80" ApplicationId="test_client" Height="80" HorizontalAlignment="Left" Margin="-12,458,0,0" Name="adControl1" VerticalAlignment="Top" Width="480" />
</Grid>
You have to use AdUnitId and ApplicationId which you get from pubCenter.
I had the same issue and wrote a blog post about it. Here's the important stuff:
The symptoms of a problem with the SDK's AdControl
seem to be pretty consistent: The page loads, the control flickers briefly, showing the hint of a 1 pixel frame, and then, poof. It collapses into nothingness, leaving only a black hole of dispair.
In theory, setting up the AdControl
is simple. The documentation from Microsoft outlines the basics:
Microsoft.Advertising.Mobile.UI
.AdUnitId
and ApplicationId
properties to either test values or actual live values, which you can obtain from Microsoft pubCenter.But it couldn't be that easy. I followed the documentation carefully, but nothing was working. I couldn't even get test ads to show up, which seemed really weird. I even reverted to an older version of my app (yay source control!) and dropped in the new .dll. Failure.
Finally, I found a clue in an obscure forum post.
The Microsoft documentation neglects to mention several important details. You need to pay particular attention to the following if you're upgrading an existing project to the Mango ad SDK, as I was:
AdControl
. Failing to specify the Height
and Width
attributes, or setting them to auto
, will cause tears of frustration. I'd recommend 80 pixels high and 480 pixels wide, as that's the native size of the ads that Microsoft serves up.AdControls
on the same page, or at least not in the same parent element. The second one will collapse. There might be a way around this, but I discovered it while building my demo app and didn't care to pursue a solution. WMAppManifest.xml
file. Since I was upgrading my app, I didn't have some of the newer capabilities declared. The one that was causing all the trouble was ID_CAP_IDENTITY_USER
. The following capabilities are all required for the control to function correctly: <Capabilities> <Capability Name="ID_CAP_IDENTITY_USER"/> <Capability Name="ID_CAP_MEDIALIB"/> <Capability Name="ID_CAP_NETWORKING"/> <Capability Name="ID_CAP_PHONEDIALER"/> <Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/> </Capabilities>
Hope that helps!
One more think to note for those still struggling
xmlns:ads="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
<ads:AdControl Height="80"
Width="480"
AdUnitId="Image480_80"
ApplicationId="test_client" />
As in example. Declaring ads and the namespace is super important. In my project i just inserted the adcontrol part alt + enter for resharper to do the rest of the work which he didnt. He replaces ads with UI and there was no error compilation still the ads wouldn't show. When i declared ads myself and changed the adcontrol namespace. Everything worked fine.