Skip to content

FAQ

What is the proper way to dispose(close) an ADvantage banner?

In order to destroy the ADvantage instance you can use dispose() method. This method destroys the internal state of the given ADvantage instance. Further, it removes the current instance from its parent view and stop all active listeners, timer(s) and observer(s).

//Destroy the current instance of ADvantage!.
 banner.dispose();

How to use ADvantage with HTTP?

It is possible to use Advantage with HTTP, you just need to make one small modification in your manifest.

Here is a sample:

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
        ...
    </application>
</manifest>

How to pre-fetch an ADvantage banner for display?

In order to show the banner when the banner is loaded or in the other way around you are able to dispose the banner. This is possible with ADvantage via adLoaded() event handler.

Here is a sample:

protected void onCreate(Bundle savedInstanceState) {
...
//Initialize ADvantage object.
banner = new Advantage(this, "<LICENSE_KEY>", "<SITE_ID>", "<POSITION>");
//Add ADvantage view to your layout.
container.addView(banner);

//Hide ADvantage object.
banner.setVisibility(View.GONE)

//Show banner.
banner.showAd();

banner.setEventHandler(new EventHandler() {

@Override
public void adLoaded(LOADING_STATUS status) {
    if(status==LOADING_STATUS.LOAD_WITHOUT_ERROR)
        //show banner when is loaded.
        banner.setVisibility(View.VISIBLE);
    else
        Log.i("loading status: "+ status.name());
    }
}

How to listen for ADvantage size changes on a dynamic banner?

ADvantage is extended from Android View therefore you can listen for size changes by overriding the onSizeChanged method of ADvantage instance.

 Advantage advantage = new Advantage(this, <LICENSE> ,<SITE>,<POSITION>)
 {
 @Override
 protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
     super.onSizeChanged(width, height, oldWidth, oldHeight);
     //Show new size of ADvantage instance.
     Toast.makeText(context, "Height:  "+height+" ,  Width: "+width, Toast.LENGTH_SHORT).show();
     }
 };

How to enable debugging mode in ADvantage?

The setDebugEnabled method could be used to enable detailed logging and debug reports for each instance of ADvantage.

banner.setDebugEnabled(true);

Why should I enable hardware acceleration?

It is required that you enable hardware acceleration in your app. The reason is that many advertisements are using CSS3 or canvas objects to animate the advertisements. Without the hardware acceleration most of the advertisements will not work correctly or will look broken. Also the performance of the ads will improve (cpu, battery usage and etc.).