Home / Android / Banners

Banners

Banners:

Banners are a type of ad unit that occupies a spot of a specific size (320x50, 728x90 or 300x250) within your app's layout. This type of ad unit can not be hidden.

You can add a banner into your app declaring it on the xml layout of your Activity or Fragment:

<com.tappx.sdk.android.TappxBanner
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tappx_banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:txAppKey="**YOUR-APP-KEY"
app:txAdSize="**AD-SIZE"
>

The available sizes are the following:

  • Smart: Adjusted automatically inside the device screen. The sizes you can request are: 320x50 and 728x90.
  • 320x50: Standard Banner for phones.
  • 728x90: Standard Banner for tablets.
  • 300x250: (Mrec): Rectangular banner for phones and tablets.

Important: To get the best memory management you must destroy the banner once used, usually in the onDestroy() or onViewDestroyed() methods of your Activity or Fragment.

Minimal Banner Example Use xml:

    public class MainActivity extends Activity {
TappxBanner banner;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
banner = (TappxBanner) findViewById(R.id.tappx_banner);
}

@Override
protected void onDestroy() {
super.onDestroy();
banner.destroy();
}
}