VMAX
 
 
 
 
Show Sidebar

Requesting Native Ads – Windows Phone 8.1 SDK

Maaf, entri ini hanya boleh didapati dalam bahasa English. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

This page will help you utilize a Native Ad Helper Library to render the native ads in a couple of predefined formats.

The VMAX Native Ad Helper Library has been designed to reduce the efforts of the developer in rendering the native ads. The library helps in rendering the native ads in any one of the four formats.

Integrating the SDK

Complete the following steps to integrate the helper library with your application.

  1. Include the <packages> folder in your project’s folder structure if you haven’t done so yet.
  2. Using Project -> Add Reference -> Browse , add the VMAXNativeAdHelper.WP81.dll to your project.
    It is present in the packages/VMAX folder.

Getting Started

The library internally provides four controls which can be added to the xaml file. InfeedControl, ContentStreamConrtol, TileControl and IconControl. You may even create an object of these control in the backend and add it to any one of your grids programmatically. This is how the library can be referred in the xaml:

and this is how the controls can be referred to:

For code behind access, add the namespace after referring the dll in the project as:

Once the controls have been placed in the xaml, what remains is the actual native ad data to be shown in these controls. You can get the native ad data using the VMAX Windows phone sdk by selecting appropriate Ad UX Types and using proper Adspot Id as shown below in Requesting Native Ads. You should, then, call an API SetContentAndShowNativeAd() on the controls. This API takes JObject (JSON object) as a parameter. (If you do not have a reference to the Newtonsoft.Json library, add it using the nuget package manager.) This JObject, you can obtain from the NativeAd property of the adView. The GetContent() API will return you a JObject from the native ad as shown here.

Once you call this API with its necessary parameter, the control will be populated with the necessary parameters from the JObject that was provided.

Here is a sample image showing the appearance of the ads:

Infeed

 

In-feed ad

cs

 

Content Stream ad

Tile-300x272

Tile

IconAd

Icon

Requesting Native Ads

Native ads are ads which you can customize to match the unique user experience of your app. Native ads can be requested in the following manner:

Extension to Native Icon ads

In addition to using the icon as an element to invoke an ad, you can use other ad elements in VMAX. Currently, the following elements are supported for the icon ad format as part of image extension sub-feature:

  • imageIcon
  • imageMain
  • imageMedium

You can choose between rendering the Icon ad by specifying the element desired from among:


This is how the library can be referred in the XAML:
and this is how the IconImageType can be referred to:
Add the namespace after referring the dll in the project as follows:
You can set IconImageType as follows:

What would you like to do next?