Get Started with Vungle - Windows SDK v. 1.0 - v.1.3.16

Use this guide to easily integrate our SDK into your app and start monetizing.

The code samples in this guide are in C#, but we provide sample app files in C#, C++, Visual Basic, and DirectX+XAML here.

A few notes before you get started...

  • The integration requires a Vungle account, so create a Vungle account if you don't have one handy.
  • If you haven't already done so, head over to our dashboard and add your app to your account. You need to do this so that you can get your App ID, which you’ll be adding to your app with our SDK. It’s in red on your app’s page.
  • Vungle ads on Windows N & KN Edition: For users with special N or KN edition of Windows, "Media feature pack for Windows 10 N and KN Editions" must be installed for Vungle ads to work.

Contents

  1. Download the SDK
  2. Add VungleSDK to your project
  3. Obtain a VungleAd instance
  4. Create and register an event handler
  5. Play an ad!

1. Download the SDK

Download the Vungle Windows SDK from the Vungle Dashboard. Extract the archive once it's finished downloading.

2. Add VungleSDK to your project

  1. In Visual Studio 2015, create a new project using the template appropriate for your application and programming language.
  2. Add a reference for your project to the Vungle Windows SDK file you downloaded.
  3. Make sure that your project has the "internetClient" capability in the package.appxmanifest file, as shown:
    <Capabilities>
        ...
        <Capability Name="internetClient" />
        ...
    </Capabilities>
  4. Import the VungleSDK namespace. For example:
    using VungleSDK;

3. Obtain a VungleAd instance

For example:

VungleAd sdkInstance;
...
sdkInstance = AdFactory.GetInstance("yourAppId");

In the above example, replace yourAppId with your app id.

4. Create and register an event handler

Create event handler for OnAdPlayableChanged event. For example:

//Event handler for OnAdPlayableChanged event
private async void SdkInstance_OnAdPlayableChanged(object sender, AdPlayableEventArgs e)
{
  //Run asynchronously on the UI thread
  await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
  new DispatchedHandler(() => someMethod()));
}

Register this event handler for OnAdPlayableChanged event. For example:

sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged;

Check out our Advanced Settings Guide to subscribe to play events. These can be used to unpause audio, resume gameplay, etc.

5. Play an ad!

Play an ad with your desired options selected (learn how to set options in the Advanced Settings Guide); for example:

private async void IncentivizedConfigButton_Click(object sender, RoutedEventArgs e)
{
  await sdkInstance.PlayAdAsync(new AdConfig { Incentivized = true , SoundEnabled = false});
}

NOTE: While your app is in Test mode, you will not be able to download any of the apps advertised. Additionally, the Dashboard will not report the number of impressions. This is because test ads are used only to verify that you have integrated the SDK correctly. This functionality becomes available once your app has gone live in active mode.

General notes

Please keep in mind for UWP builds: the Back button is supported on mobiles, but not on PCs (keyboard). This can result in different behavior and user experience for UWP builds.

Have more questions? Submit a request

Comments