Skip to main content

Android - Banner Ad


Vpon Banner can be embedded to part of your app layout. It consists of a multimedia object which can attract user. The ads will expand to show much richer content after clicking.

successful result example


Please make sure you’ve imported Vpon SDK to your Android Studio project. If not, please refer to our Integration Guide to finish your setting.

Start To Implement Banner Ad

Android apps are composed of View objects, such as text areas, buttons and other components. VpadnBanner is simply another View subclass displaying HTML5 ads that triggered by user’s touch.

Please follow the steps below to implement Vpon Banner Ad to your application:

  1. Import*
  2. Declare a VponBanner instance and indicate a License Key
  3. Set up VponAdRequest object and send ad request
  4. Implement AdListener

We strongly recommend that you can finish all the steps in the Activity of the application.

Implement Banner Ad In MainActivity

Please follow the instruction below to add Banner Ad in your MainActivity.

Declare A VponBanner Instance and Send Ad Request


public class MainActivity extends AppCompatActivity {
        private RelativeLayout mainLayout;
        private VponBanner vponBanner;
        private String bannerId = "License Key" ;
        // bannerId: Vpon License Key to get ad, please replace with your own one

  	    protected void onCreate(Bundle savedInstanceState) {
            mainLayout = findViewById(;

            VponBanner vponBanner = new VponBanner(context);
            // adSize: The Banner Ad size that will be displayed

            VponAdRequest.Builder builder = new VponAdRequest.Builder();
            // Only available for Banner Ad, will auto refresh ad if set true
            builder.addTestDevice("your device advertising id");
            // Set your test device's GAID here if you're trying to get Vpon test ad
            // Set ad request and load ad


Note: If you want to know more about target setting, please refer to Advanced Setting.

Implement Banner Ad In Layout

You can alse implement Banner Ad in layout.xml

  <LinearLayout xmlns:android=""
      android:orientation="vertical" >

          android:layout_height="wrap_content" >

          <!-- Implement Vpon Banner Ad As Below -->
            vpon:bannerId= "License Key"/>

Not:e Please replace the parameter of ads:bannerId with your License Key

Implement AdListener

vponBanner.setAdListener(new VponAdListener() {

    public void onAdLoaded() {
        // Invoked if receive ad successfully
    public void onAdFailedToLoad(int errorCode) {
        // Invoked if received ad fail, check this callback to indicates what type of failure occurred

    public void onAdOpened() {
        // Invoked if the ad was clicked

    public void onAdLeftApplication() {
        // Invoked if user leave the app and the current app was backgrounded

Ad Lifecycle Handling

To make the Ads work more smoothly and release resource appropriately, we recommend that you can add below code snippets in the Activity Lifecycle.

protected void onDestroy() {
    if (vponBanner != null) {
        vponBanner = null;

Vpon Banner Size

Vpon Banner supports three tablet-only banner sizes in addition to the 320x50 shown on phones:

Size (WxH) Description VponAdSize Constant
320x50 Standard Banner VponAdSize.BANNER
320x100 Large Banner VponAdSize.LARGE_BANNER
300x250 IAB Medium Rectangle VponAdSize.IAB_MRECT
320x480 Large Rectangle Banner VponAdSize.LARGE_RECTANGLE
468x60 IAB Full-Size Banner VponAdSize.IAB_BANNER
728x90 IAB Leaderboard VponAdSize.IAB_LEADERBOARD

Note: The resolution of the device might impact the layout of Smart Banner. If you are trying to display Standard, it is recommend to use VponAdSize.BANNER for request.


Make Sure If The Ad Display Successfully

Please note that following settings which might cause the ad invisible on the screen are not allowed:

  • Set AdView as Invisible
  • Set the Alpha value of AdView < 100%
  • Overlays that cover the AdView

Please help to check if below log printed after the ad display and match the viewability standard:

I/VPON: [::Impression::]  response.code : 200

Sample Code

Please refer to our Sample Code for a complete integration sample.

Integration Guide For Vpon SDK v5.5

Please refer to Banner Ad Integration Guide if you want to know more about the integration that compatible with Vpon SDK v5.5 and below version.