Skip to content


Before you implement an ad space into your app you should know how ADvantage works.


  1. Initialize the ADvantage object
  2. Request and showing the ad
  3. Dispose the ADvantage object


We highly recommend the use of a factory pattern instead of implementing the whole structure for each ad space you implement. A factory class can reduce the implementation and also maintainance time.

Initialize the ADvantage object

With a valid license key and an ad positions from the ad server you will be able to initialize the ADvantage instance. (Each license key will be validated for each ad request.)

//Initialize the ADvantage object....
banner = new Advantage(activity, "license", "SiteId", "Position");

Request and showing the ad

The SDK is requesting the ad from the ad server. With different callback methods you will be notified if the ad server had a campaign which you have to show or not. Also if the ad is requesting an layout update or an error occured you will be notified.

//Register the event listener, if any...
//Add ADvantage banner to its parent. container is a view in the current activity content layout!
//Show the advertisement...

Dispose the ADvantage object

Destroying the ADvantage object in a correct way is very important. Otherwise, the ADvantage instance and also the advertisement remains in the background and consumes CPU and other resources and in worst case scenario it could lead to the memory problems. Therefore, it is highly recommended to pass the current activity's state to the given ADvantage instance by using the following methods:

protected void onPause() {
if(banner != null)


protected void onResume() {

if(banner != null)

Consequently, the ADvantage SDK can manage your app's memory and more importantly, it destroys the current ADvantage instance when the activity is in the process of finishing.

Further, if you want to destroy an ADvantage instance for any reason, you can easily use dispose() method. This method destroys the internal state of the given ADvantage instance. In addition, 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!.


If you are going to show advertisement after destroying an ADvantage instance, you SHOULD re-initialize the given instance and add it to its container view again.