Windows phone ads not working

前端 未结 3 707
感动是毒
感动是毒 2020-12-28 20:12

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

相关标签:
3条回答
  • 2020-12-28 20:41

    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.

    0 讨论(0)
  • 2020-12-28 20:47

    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:

    • Download and install the Microsoft Advertising SDK.
    • Add a reference to Microsoft.Advertising.Mobile.UI.
    • Drag the control onto the page in the Visual Studio designer.
    • Set the 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:

    • You must specify a height and width for the 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.
    • It seems that you can't have two 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.
    • You must must must specify certain capabilities in your 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!

    0 讨论(0)
  • 2020-12-28 21:03

    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.

    0 讨论(0)
提交回复
热议问题