none
How to add multiple instances of the native ad UWP RRS feed

  • Question

  • I have an UWP app which displays several catalogs of videos. They are located in separate pages. For this purpose I've created an `NativeAdV2` control:

    public sealed partial class CardAdvert : UserControl
        {
            NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId);
            NativeAdV2 advert;
            public CardAdvert()
            {
                InitializeComponent();
                manager.AdReady += AdReady;
                manager.RequestAd();
            }
    
            private void AdReady(object sender, NativeAdReadyEventArgs e)
            {
                advert = e.NativeAd;
                Initialize();
                e.NativeAd.RegisterAdContainer(this);
            }
    
            public void Initialize()
            {
                title.Text = advert.Title;
                image.Source = new BitmapImage(advert.MainImages.First().Url.ToUri());
                if (advert.AdIcon == null)
                    contentGrid.ColumnDefinitions[0].Width = new GridLength(0);
                else
                    icon.ProfilePicture = advert.AdIcon.Source;
    
                if (string.IsNullOrWhiteSpace(advert.SponsoredBy))
                    sponsor.Visibility = Visibility.Collapsed;
                else
                    sponsor.Text = advert.SponsoredBy;
    
                if (!string.IsNullOrWhiteSpace(advert.Rating))
                    info.Text += $" {advert.Rating}";
    
                if (string.IsNullOrWhiteSpace(advert.CallToActionText) && string.IsNullOrWhiteSpace(advert.Price))
                    desc.Visibility = Visibility.Collapsed;
                else if (!string.IsNullOrWhiteSpace(advert.CallToActionText))
                    desc.Text = advert.CallToActionText;
                else
                    desc.Text = advert.Price;
            }
        }

    But no matter where I create it (even on different page) on the second time it throws me an exception on calling `e.NativeAd.RegisterAdContainer(this);`: 

    Unhandled exception at 0x082A1330 (Windows.UI.Xaml.dll) in FoxTube.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x1E9F4608, 0x00000003).

    Perfectly, I'd like to insert this control every 10 videos. Or at least on every page. Is there any solutions?

    Minimum version: Fall Creators Update (16299)

    Target version: October 2018 Update (17763)

    Advertising SDK version: 10.1805.7001 (downloaded from NuGet)

    Sample that represents that issue: https://1drv.ms/u/s!AnQ5WkWqz7MKi90UU-aBd9i78oyteQ

    • Edited by XFox111 Sunday, April 7, 2019 2:25 PM
    Saturday, January 5, 2019 2:30 PM

Answers

  • Hi SFox111,

    Sorry for the delay reply.If you are not using features which providing the latest version(Build 17763 ), could you below the target version(build 16299)?You could refer to the Choose a UWP version for the chosen reference.

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by XFox111 Sunday, April 7, 2019 2:35 PM
    Tuesday, January 29, 2019 8:22 AM
    Moderator

All replies

  • Hi XFox111,

    I design part of XAML according to the code you provide, however I could successfully display the Native advertisement. Could you provide your complete sample for me to analyze this issue(Don't include any personal information)? By the way, please also show your app's targeted version.

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 7, 2019 7:02 AM
    Moderator
  • https://1drv.ms/u/s!AnQ5WkWqz7MKi90UU-aBd9i78oyteQ

    Here's the sample. This is not my project but it represents the same mechanism of ads delivering and the same issue.

    Minimum version: Fall Creators Update

    Target version: October 2018 Update

    Visual Studio 2019 Preview

    Advertising SDK is downloaded from NuGet. Version is 10.1805.7001



    • Edited by XFox111 Sunday, April 7, 2019 2:25 PM
    Monday, January 7, 2019 4:03 PM
  • Hi XFox111,

    I have helped you to consult the related team. I will post here if I got any response.It may take a little more time,please be more patient.

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 9, 2019 9:30 AM
    Moderator
  • We are seeing the same thing which is why we gave up implementing native ads.  We contacted the advertisement team directly and never got a response.
    Thursday, January 10, 2019 9:12 PM
  • Hi SFox111,

    Sorry for the delay reply.If you are not using features which providing the latest version(Build 17763 ), could you below the target version(build 16299)?You could refer to the Choose a UWP version for the chosen reference.

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by XFox111 Sunday, April 7, 2019 2:35 PM
    Tuesday, January 29, 2019 8:22 AM
    Moderator
  • Yeah... Actually... It's working. But is there any solution without downgrading target version? I actually do use new features and I'd like to access them more... conveniently. It's really hard to support old versions when you're trying to move on and use latest technologies and APIs. And sorry for such long response time. For some reason MSDN didn't notify me about new answers...
    • Edited by XFox111 Sunday, April 7, 2019 2:39 PM
    Sunday, April 7, 2019 2:38 PM
  • Is there any other solution to this issue? Because I can't downgrade the Target Version to 16299. Can you plz someone from the Engineering team on what is the workaround for this issue when the target version is 17763?
    Thursday, August 22, 2019 4:10 PM