VMAX
 
 
 
 
Show Sidebar

Requesting Native Ads – Android SDK

Sorry, this entry is only available in 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.

Using Native Helper Libraries is a recommended method to request Native ads. We have also included an alternative method here.

Note: Native Helper Libraries are available for VMAX SDK version 3.5.1 and above.

Native Helper Libraries

The VMAX Native Ad Helper Libraries have been designed to reduce the efforts of the developer in rendering the native ads. The libraries help in rendering native ads in any one of the four formats:

  1. In-feed
  2. Content Stream
  3. Tile
  4. Icon

To request a native ad in 3.5.1 and above

Note: To Fetch Native Ad always only use cacheAd(). No need to call showAd() or loadAd() for invoking Native Ads. Once you call the cacheAd() API for native ad you will get callback of native ad in adViewDidCacheAd().

Enable hardware acceleration to support video ads. In order to perform optimally, please enable hardware acceleration by adding the following line to your application tag in your manifest:

Using Native Helper Libraries: This will help in rendering Native Ad in below formats

  1. ContentStream(300 x 250) : Make sure you add “contentstream.jar” and “res(drawables and layouts)” available in sdk folder “/Native Helper Files”.  Recommended Native Express Ad Template is Large Template on Admob dashboard.
    Add in your Layout XML
    Add in your Activity Code
  2. Infeed (320 x 80):  Make sure you add “infeed.jar” and “res(drawables and layouts)” available in sdk folder “/Native Helper Files”. Recommended Native Express Ad Template is Small Template on Admob dashboard.
    Note: For VMAX SDK versions before 3.5.9 InFeed resolution was (320 x 50).
    Add in your Layout XML
    Add in your Activity Code
  3. Icon(80 x 80):  Make sure you add “icon.jar” and “res(drawables and layouts)” available in sdk folder “/Native Helper Files”. Currently, Icon does not support Native AdMob Express ads.
    Add in your Layout XML
    Add in your Activity Code
  4. Tile(300 x 300):  Make sure you add “tile.jar” and “res(drawables and layouts)” available in sdk folder “/Native Helper Files”.Recommended Native Express Ad Template is Large Template on Admob dashboard.
    Add in your Layout XML
    Add in your Activity Code

To request a native ad in 3.5.0 and below

Once you call the cacheAd() API for native ad you will get callback of native ad in adViewDidCacheAd().
Once you got the nativeAd object then you can get each elements of nativeAd using below API.
Make sure to call our below mentioned API in case of native ads to track impression and clicks.
We have exposed some helper methods for showing the native ads using our NativeAdHelper class. The Native Ad Helper class is optional for developers.

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 two formats: In-feed and Content Stream.

Create the Object of the NativeAdHelper class as shown below.

Here, context should be the context of your class, nativeAd should be the nativeAd object received in adViewDidCacheAd() API, mNativeAdView should be the instance of vmaxAdView, and AdType.IN_FEED is the type of the ad you requesting for.

After that use the API shown below.

Optional Callbacks

If you want the callbacks for success or failed to render the Native Ad on the ViewGroup then you have to register the native ad listener as shown below.

This will give callback in two api for Success and Failed as shown below.

Important: Constants need to be mapped on mediation partners dashboard for Native Ads

Some Mediation partners like Inmobi requires custom Json keys from developer. So below list of Constants can be used to show various components of Native Ads

Below are the key constants with its description which need to be mapped as it is on mediation partner dashboard for proper functioning of Native Ads in the VMAX SDk:

Read more on Advanced Targeting here.

Advanced

VMAX allows you to cache a native ad in one Activity and show it in a different Activity.

To Cache Native Ads

To Show Native In-Feed Ads

Create below Layout in main layout file

To Show Native Content Stream Ads

Create below Layout in main layout file

To Show Native Icon Ads

Create below Layout in main layout file

To Show Native Tile Ads

Create below Layout in main layout file

What would you like to do next?