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 Xcode 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 VpadnBanner instance
  3. Set up VpadnBanner instance and indicate a License Key
  4. Request for a banner ad
  5. Implement VpadnAdListener

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

Implement Banner in MainActivity

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

Import Vpon SDK And Declare A VpadnBanner Instance


public class MainActivity extends Activity implements VpadnAdListener {
    private RelativeLayout adBannerLayout;
    // Declare VpadnBanner instance
  	private VpadnBanner vponBanner = null;

  	// Please fill in with your License Key
  	private String bannerId = "License Key" ;

Set Up VpadnBanner Instance And Indicate A License Key

public class MainActivity extends Activity implements VpadnAdListener {
  	protected void onCreate(Bundle savedInstanceState) {
  		// Get your layout view for Vpon banner
  		adBannerLayout = (RelativeLayout) findViewById(;

  		// In SDK 4.8.0 and below, create VpadnBanner instance
                vponBanner = new VpadnBanner(this, bannerId, VpadnAdSize.SMART_BANNER, "TW");
                // In SDK 4.8.1 and above, create VpadnBanner instance
                vponBanner = new VpadnBanner(this, bannerId, VpadnAdSize.SMART_BANNER);
  		VpadnAdRequest adRequest = new VpadnAdRequest();
  		// Set "true" to enable banner ad auto refresh
                // Load vpon banner
                // Add vpon banner to your layout view

  	protected void onDestroy() {
  		if (vponBanner != null) {
  			//remember to call destroy method
  			vponBanner = null;

Implement Banner Ad In Layout

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

          android:layout_height="wrap_content" >

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

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

Request for Test Ad

Please add the code snippet to your application and fill in with your test device’s UUID as below to request for test ads.

public class MainActivity extends Activity implements VpadnAdListener {
        VpadnAdRequest adRequest =  new VpadnAdRequest();

        HashSet<String> testDeviceImeiSet = new HashSet<String>();
        // Add Android device advertising id
        testDeviceImeiSet.add("your device advertising id");


Advertising ID

Here are some tips for you to get your advertising id:

  1. Find “advertising_id” from the log (Find “advertisingId” instead if you are using 4.8.3 or above)
  2. Check the advertising id in the Setting of your device

Implement VpadnAdListener

public class MainActivity extends Activity implements VpadnAdListener {
        public void onVpadnReceiveAd(VpadnAd ad){
                Log.d("Banner", "VpadnReceiveAd");

        public void onVpadnFailedToReceiveAd(VpadnAd ad, VpadnAdRequest.VpadnErrorCode errCode){
                Log.d("Banner", "fail to receive ad (" + errCode + ")");

        public void onVpadnPresentScreen(VpadnAd ad){
                Log.d("Banner", "VpadnPresentScreen");

        public void onVpadnDismissScreen(VpadnAd ad){
                Log.d("Banner", "vpadnDismissScreen");

        public void onVpadnLeaveApplication(VpadnAd ad){
                Log.d("Banner", "VpadnLeaveApplication");

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 VpadnAdSize.BANNER
300x250 IAB Medium Recangle VpadnAdSize.IAB_MRECT
468x60 IAB Full-Size Banner VpadnAdSize.IAB_BANNER
728x90 IAB Leaderboard VpadnAdSize.IAB_LEADERBOARD
device width x auto height Smart Banner VpadnAdSize.SMART_BANNER

We recommend that you can use the Smart Banner constant. (VpadnAdSize.IAB_WIDE_SKYSCRAPER is not available currently)


Sample Code

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

More Ad Formats

Please refer to the link below to learn more about other ad types: