Reputation: 269
In my UWP app I use an AdControl
that can be either 320x50 or 640x100 depending on the windows size. The problem is that I can't get it to display ads if I'm using my AppID and UnitID even though it displays them if I use the test IDs provided by Microsoft. The app has the Internet Client capability, is privately available in the store since last week and I'm debugging it on an italian IP. TheErrorOccured
event gives me a NoAdAvailable
error. How could I solve this?
EDIT 1:
I installed the Microsoft Ads SDK using the link of the answer but I now get on this line of code global::Windows.UI.Xaml.Application.LoadComponent(this, resourceLocator, global::Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
in the MainPage.g.i.cs file this error: Windows.UI.Xaml.Markup.XamlParseException
.
Is there a way I can solve it?
Upvotes: 0
Views: 120
Reputation: 2015
You May miss something Follow these steps-
1) Download this SDK
2) Add a reference to the Microsoft Advertising SDK in your project: From the Solution Explorer window, right click References, and select Add Reference…
In Reference Manager, expand Universal Windows, click Extensions, and then select the check box next to Microsoft Advertising SDK for XAML (Version 10.0).
In Reference Manager, click OK.
3) Modify the XAML for the page where you are embedding advertising to include the Microsoft.Advertising.WinRT.UI namespace Add this line of code in xaml references -
xmlns:UI="using:Microsoft.Advertising.WinRT.UI"
4) Then add your ad control with Ad Unit and ID from store
<UI:AdControl ApplicationId="Your Ad ID"
AdUnitId="Your AdUnit"
HorizontalAlignment="Left"
Height="250"
VerticalAlignment="Top"
Width="300"/>
this is example for Banner ads so go to your dev dashboard Monetize > In App Ad then Create new ad unit.
*Select Your App,
*Add ad unit name,
*Select ad unit type to banner,
*and device family Windows 10 UWP.
and click on create after that copy your ad unit id and app id and pase in you ad control in xaml
Then Debug your app in x86,x64x,ARM then wait few seconds (according to your internet connection) ad will appear soon.
Further after submission of app package to the store you need to configure ad mediation.. read this article for this it will show you everthing step by step
Upvotes: 1