Skip to content

Event Handlers

If you want to handle ADvantage events, you will need to call the setEventHandler method in the Advantage object.

adError

This method will be called in any error case such as, no internet, connection/timeout, license issues and etc. The String msg will contain the error message which you can log into the logcat to trace the problem!

@Override
public void adError(Advantage advantage, String msg, Enum.ErrorCategory errorCategory) {...}

Errors reported by ADvantage will be in one of these categories:

  • CONTENT_LOAD_FAILED - If the content could not load for any reason.
  • DOWNLOAD_FAILED - If the download of the Advantage banner fails.
  • LICENSE_NOT_AUTHENTICATED - The license is not valid, or authentication failed for some other reason.
  • INITIALIZATION_FAILED - The ADvantage object could not be initialized.
  • WEBVIEW_RECEIVED_ERROR - For any error received from the ADvantage webview
Version 2.5.3.2 and earlier

In previous releases this method was slightly different:

@Override
public void adError(Advantage advantage, String msg) {...}

adClosed

This method will be called when an ad is completely closed!

@Override
public void adClosed(Advantage advantage) {...}

adLoaded

This method will be called when the ad request was completed. This callback contains an status which is an enumerator and could have the following values:

  • LOAD_WITHOUT_ERROR - Ad loaded successfully.
  • LOAD_WITH_ERROR - An error occurred during the loading process.
  • LOAD_WITHOUT_CAMPAIGN - There is no campaign available at the moment.
@Override
public void adLoaded(Advantage advantage, LoadingStatus status) {...}

adExpanded

This method will be called when an modal view is created (it will be triggered by the advertisement)

@Override
public void adExpanded(Advantage advantage) {...}

adResized

This method will be called when the ad space changes its size e.g. height change (it will be triggered by the advertisement)

@Override
public void adResized(Advantage advantage) {...}

adNotify

This method is reserved for custom external plugins and future use cases.

@Override
public void adNotify(Object object) {...}