Banners
Create banner using code
To get an ad you need to create it with your App Key, set up the configuration and request an ad.
Example of a banner request:
public class MainActivity extends Activity {
ViewGroup bannerContainer;
TappxBanner banner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bannerContainer = (ViewGroup) findViewById(R.id.banner_container);
Context context = this;
banner = new TappxBanner(context, "**YOUR-APP-KEY**"); //Create the banner
banner.setAdSize(AdSize.SMART_BANNER);
bannerContainer.addView(banner); //add the banner to the view
banner.loadAd(); //request a new ad
}
@Override
protected void onDestroy() {
super.onDestroy();
if (banner != null) banner.destroy();
}
}
Tappx © 2024