WPF app call UWP app to show Ads RRS feed

  • Question

  • We have a WPF App, and has published it to the Microsoft App store using Desktop App Converter. Lately, we try to add Microsoft Interstitial ads in the App.
    But now, Microsoft Interstitial ads only support in the UWP project. So, we add new UWP ads project in our exist WPF project and this UWP project only to show the Interstitial ads.
    The existing WPF project will launch this UWP ads project when need to show the ads.
    it works well with appxbundle test package, that was built with vs2017, and the Ads could be shown normally. When publish the appxupload package to the Microsoft store, and after download/install the app from the store, the ads UWP App could be launched by the WPF App but failed to get the Interstitial ads.
    My questions are:
      1. And does this solution supported by the Microsoft?
      2. why it works well with test package but failed with the official installation from the Microsoft App Store?

    The following is the detail steps I have done for this:
    1. Let the WPF App could launch the UWP ads App.
      1.1 Add new UWPAdsApp project in the existing App Solution.
      1.2 Add "windows.protocol", showuwpads, in the Package.appxmainifest
            <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
                <uap:Extension Category="windows.protocol" Executable="UWPAdsApp.exe" EntryPoint="UWPAdsApp.App">
                  <uap:Protocol Name="showuwpads" />
      1.3 In the WPF App side, add function to launch the UWP Ads App, and call this function if need to show ads.
          public async static void ShowAds()
              string str = "showuwpads://";
              Uri uri = new Uri(str);
              var success = await Windows.System.Launcher.LaunchUriAsync(uri);
              if (success == true)
      1.4 In the UWP App side, override the OnActivated function to activate the UWP App via the Protocol. (Added in the App.xaml.cs)
            protected override void OnActivated(IActivatedEventArgs args)
                switch (args.Kind)
                    case ActivationKind.Protocol:
                        ProtocolActivatedEventArgs protocolArgs = (ProtocolActivatedEventArgs)args;
                        Uri uri = protocolArgs.Uri;
                        if (uri.Scheme == "showuwpads")
                            Frame rootFrame = Window.Current.Content as Frame;
                            if (rootFrame == null)
                                rootFrame = new Frame();
                                Window.Current.Content = rootFrame;
                            //Request the Microsoft Interstitial Ads here

    2. Request and show the ads in UWP App.
      2.1 Add functions to handle the ads in the UWP App.

          InterstitialAd adInterBanner = new InterstitialAd();
          private void RequestAds()
              adInterBanner.ErrorOccurred += OnAdError;
              adInterBanner.AdReady += OnAdReady;
              adInterBanner.Cancelled += OnAdCancelled;
              adInterBanner.Completed += OnAdCompleted;
              adInterBanner.RequestAd(AdType.Display, "d25517cb-12d4-4699-8bdc-52040c712cab", "test");   // here, we have used the real appid and ad uint id; these ids are just example here.
          private void OnAdReady(object sender, object e)
              InterstitialAd ad = (InterstitialAd)sender;
              if (ad == adInterBanner)
          // This is an event handler for the interstitial ad. It is triggered when the interstitial ad is cancelled.
          private void OnAdCancelled(object sender, object e)
          // This is an event handler for the interstitial ad. It is triggered when the interstitial ad has completed playback.
          private void OnAdCompleted(object sender, object e)

          // This is an error handler for the interstitial ad.
          private void OnAdError(object sender, Microsoft.Advertising.WinRT.UI.AdErrorEventArgs e)



    • Edited by Tom _201910 Wednesday, October 9, 2019 1:34 AM
    Monday, September 23, 2019 2:27 PM

All replies

  • Hi Tom,
    Did you replace the test ids with real application Id and Ad unit id before you package your app?Ads will not appear if you're using a test mode value for your ad unit ID when running a live app. If you has replaced, could you use Fiddler to monitor advertising the sending and receiving of request to see if there is error ?
    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

    Tuesday, September 24, 2019 7:51 AM
  • There are multiple reasons - most of which have been covered in the forums at some point


    Using correct ids

    Waiting around 48 hrs from 'live' to first ads appearing

    Fill rates, generally less than 5% on average + will depend on territory so expecting to see interstitial ads is ambitious!

    MS publishing process completely BROKEN. See if your app/ad units get listed in your Ad performance part of dashboard. If not then chances are the mysterious publishing issue is still not fixed and you need to get MS support to manually poke something with a big stick.


    Tuesday, September 24, 2019 8:04 AM
  • hello Daisy  Tian,

        Thanks for your reply.

        Yes, I have replaced with the real application id and Ad unit id, above is just the example code. As you suggested, I debug with the Fiddler, the following is the result:

         1. Testing with the appxbundle test package: we could see that the app has sent out the Ad Request packet, and it works well.

         2. And also checking the app, that is downloaded from the store, I could not see any Ad Request packet sent from app, and the UWP app exit immediately. 

         The above two tests are with same source code, the only difference is: workable one is appxbundle test package,  the failed one is app from the store.

         I am not sure whether Microsoft store allow to show Ads in the UWP app, that is packaged in a desktop bridge app (WPF) and is launched via the protocol? if yes, what will be the root cause of my problem? and how could I find it out? thanks a lot for your helps.



    Friday, September 27, 2019 3:14 PM