Events
You can observe the lifecycle of a FuseFullScreenAdView
by listening to its emitted events.
Currently, the following events are available:
- An ad has started loading
- An ad has finished loading successfully
- An error occurred while loading an ad
- An ad impression was recorded
- The ad was dismissed
- Display of an ad timed out
- The ad couldn’t be displayed due to error
- A reward was received (for rewarded and rewarded interstitial ads only)
iOS
extension ViewClass: FuseFullScreenAdViewDelegate {
func onEvent(adView: FuseFullScreenAdView, event: FuseAdViewEvent) {
switch (event) {
case .loading: break // Do something when ad started loading, maybe, show a progress bar
case .loaded: break // Ad was loaded, calling show() should display it straight away
case .impression: break // Ad impression was recorded
case .error(let e): break // Loading error
case .dismissed: // The ad was dismissed by the user, continue the app flow
case .displayTimeout: break // The ad couldn't be displayed within given timeout, continue the app flow
case .displayError(let e): break // The ad couldn't be displayed due to an error
case .reward(let type, let amount):
break // A reward was received
default: break
}
}
}
let ad = FuseFullScreenAdView(code: "<zone_code>")
ad.delegate = self
Android
val ad = FuseFullScreenAdView("<zone_code>")
ad.listener = object : FuseFullScreenAdViewListener {
override fun onEvent(
adView: FuseFullScreenAdView,
event: FuseAdViewEvent,
) {
when (event) {
is FuseAdViewEvent.Loading -> { /* Do something when ad started loading, maybe, show a progress bar */ }
is FuseAdViewEvent.Loaded -> { /* Ad was loaded, calling show() should display it straight away */ }
is FuseAdViewEvent.Impression -> { /* Ad impression was recorded */ }
is FuseAdViewEvent.Error -> { /* Loading error */ }
is FuseAdViewEvent.Dismissed -> { /* The ad was dismissed by the user, continue the app flow */ }
is FuseAdViewEvent.DisplayTimeout -> { /* The ad couldn't be displayed within given timeout, continue the app flow */ }
is FuseAdViewEvent.DisplayError -> { /* The ad couldn't be displayed due to an error */ }
is FuseAdViewEvent.Reward -> { /* A reward was received */ }
else -> null
}
}
}