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 fun adError(advantage: Advantage?, errorMsg: String?, errorCategory: Enum.ErrorCategory?) {...}
@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 - The content could not load for any reason.
  • DOWNLOAD_FAILED - 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 web view
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 fun adClosed(advantage: Advantage?) {...}
@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 fun adLoaded(advantage: Advantage?, status: Enum.LoadingStatus?) {...}
@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 fun adExpanded(advantage: Advantage?) {...}
@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 fun adResized(advantage: Advantage?) {...}
@Override
public void adResized(Advantage advantage) {...}

adNotify

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

override fun adNotify(`object`: Any?) {...}
@Override
public void adNotify(Object object) {...}