Android Monetisation SDK Getting Started

The latest version of vNative Monetization SDK supports Android OS versions 4.0.3 (API level 15) and later.

SDK GitHub Link: https://github.com/vNative/VT-Android-Ad

Adding the SDK to your Project

Requirements

  1. Android API 15 (min).
  2. An App token provided in vNative Dashboard.

Install

  1. Download vnative_ads_library.aar from this link
  2. Import AAR in in your android studio project. Need help importing aar file to your project read from this link

Usage

Initialize VNativeAd in your launcher Activity onCreate method:

VNativeAd.init(this, "YOUR_APP_TOKEN");

Banner Ads

Sample usage:

VNativeBanner banner = new VNativeBanner();
banner.load(<CONTEXT>, <BANNER_SIZE>, <BANNER_POSITION>);

Banner sizes available are:

  1. VNativeBanner.Size.BANNER_50 : The resulting banner will have 50 pixels height.
  2. VNativeBanner.Size.BANNER_90 : The resulting banner will have 90 pixels height, this is specially recommended for tablets devices.

Banner positions available are:

  1. VNativeBanner.Position.BOTTOM : This will render the banner on the bottom side of the screen.
  2. VNativeBanner.Position.TOP : This will render the banner on the top side of the screen.

Note: Banner Ads can only be loaded in Activities

Banner Ad Demo:

                                       

Interstitial Ads

Sample usage:

VNativeInterstitial interstitial = new VNativeInterstitial();
interstitial.load(this);

Interstitial Ad Demo:

                                     

Native Ads

To implement native Ads, create custom view and hook up view with data.

Step 1: Implement NativeAd.OnNativeAdListener in your class. Step 2: Override onNativeAdLoad(NativeAdModel model) method.

NativeAdModel provide built in methods for images, title, description, etc.

  • For Ad image getAdImage() method provide ad image url.
  • For Ad title getAdTitle() method provide ad title string.
  • For Ad description getAdDescription() method provide ad description string.

Sample usage:

public class MainActivity extends AppCompatActivity implements NativeAd.OnNativeAdListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        VNativeAd.init(this, "YOUR_APP_TOKEN");

        NativeAd nativeAd = new NativeAd(this);
    }

    @Override
    public void onNativeAdLoad(NativeAdModel nativeAdModel) {
      titleTextView.setText(nativeAdModel.getAdTitle());
      descriptionTextView.setText(nativeAdModel.getAdDescription());
    }
}

Create Your Account Now!

Get Started with 30 Days FREE Trial Account. No credit card required.

Get Started FREE