Show banner ads from AdDuplex. Additional setup is required once you have built the Universal Windows Platform solution from Unity - see the setup section at the bottom of the page
C#using CI.WSANative.Advertising;
Initialises the specified ad network - this should be called once for each ad network you intend to use
C#WSANativeBannerAd.Initialise(WSABannerAdType.AdDuplex, "AppId", "AdUnit or placement id");
WSANativeBannerAd.AdRefreshed is raised each time a new ad is shown
The width and height should be equal to or greater than the size of the ad - ad sizes vary by provider
C#WSANativeBannerAd.CreatAd(WSABannerAdType.AdDuplex, 728, 90, WSAAdVerticalPlacement.Top, WSAAdHorizontalPlacement.Centre);
C#WSANativeBannerAd.SetVisibility(WSABannerAdType.AdDuplex, false);
The width and height should be equal to or greater than the size of the ad - ad sizes vary by provider
C#WSANativeBannerAd.ReconfigureAd(WSABannerAdType.AdDuplex, 728, 90, WSAAdVerticalPlacement.Bottom, WSAAdHorizontalPlacement.Right);
C#WSANativeBannerAd.DestroyAd(WSABannerAdType.AdDuplex);
Listen to these events for info about the ads lifecycle
C#WSANativeBannerAd.AdRefreshed
C#WSANativeBannerAd.ErrorOccurred
Perform the following steps in the uwp solution
- Open the solution and add a reference to the ad sdks you wish to use (AdDuplex SDK)
- Download this file and add it to the project which has the same name as your game. Make sure it is in the same folder as MainPage.xaml.cpp
- Open the file you just added to the project and you'll see some #defines at the top with the names of ad networks. Replace the 0 with a 1 next to the ones you plan to use
- Open MainPage.xaml.cpp and add the following includes
C##define GENERATED_PROJECT 1
#include "WSAAdvertisingBridge.h"
#include "BannerAdManager.h"
- At the bottom of the MainPage.xaml.cpp constructor add the following line
C#BannerAdManager::Initialise(m_DXSwapChainPanel);
- Open the apps manifest file and add the internet client capability