Interstitial Adverts

Show interstitial video ads from AdDuplex and Vungle. 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

Ad Network Specifics

AdDuplex

  • The Cancelled event will never be raised

Reference the library

C#
using CI.WSANative.Advertising;

Initialise

Initialises the specified ad network - this should be called once for each ad network you intend to use

C#
WSANativeInterstitialAd.Initialise(WSAInterstitialAdType.Vungle, "AppId");

Request an ad

WSANativeInterstitialAd.AdReady is raised once an ad is ready to play

C#
WSANativeInterstitialAd.RequestAd(WSAInterstitialAdType.Vungle, "AdUnit or placement id");

Show the ad

WSANativeInterstitialAd.Completed is raised if the ad plays to completion

WSANativeInterstitialAd.Cancelled is raised if the ad is closed early by the user

C#
WSANativeInterstitialAd.ShowAd(WSAInterstitialAdType.Vungle, "AdUnit or placement id");

Events

Listen to these events for info about the ads lifecycle

C#
WSANativeInterstitialAd.AdReady
C#
WSANativeInterstitialAd.Cancelled
C#
WSANativeInterstitialAd.Completed
C#
WSANativeInterstitialAd.ErrorOcurred

Setup

Perform the following steps in the uwp solution

  1. Open the solution and add a reference to the ad sdks you wish to use (AdDuplex SDK, Vungle SDK)
  2. Download this file aand 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
  3. 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
  4. Open MainPage.xaml.cpp and add the following includes
C#
#define GENERATED_PROJECT 1 #include "WSAAdvertisingBridge.h" #include "InterstitialAdManager.h"
  1. At the bottom of the MainPage.xaml.cpp constructor add the following line
C#
InterstitialAdManager::Initialise();
  1. Open the apps manifest file and add the internet client capability