Class AUMStateMachine
-
- All Implemented Interfaces:
-
com.inmobi.media.ads.common.listeners.AUMDestroyListener,com.inmobi.media.ads.common.listeners.AdUnitCallback,com.inmobi.media.ads.common.listeners.FetchTimeoutListener,com.inmobi.media.ads.common.listeners.FullScreenListener,com.inmobi.media.ads.common.listeners.InternalLoadTimeoutListener,com.inmobi.media.ads.common.listeners.PreloadTimeoutListener
public abstract class AUMStateMachine extends StateMachine implements AdUnitCallback, FetchTimeoutListener, InternalLoadTimeoutListener, PreloadTimeoutListener, AUMDestroyListener
Abstract state machine for managing Ad Unit Manager (AUM) states and transitions.
This class extends StateMachine to provide state management specifically for ad unit managers. It implements multiple listener interfaces to handle various ad lifecycle events, timeouts, and user interactions. The state machine coordinates transitions between different ad states such as CreatedState, FetchingState, FetchedState, LoadingState, and RenderedState.
-
-
Constructor Summary
Constructors Constructor Description AUMStateMachine(CoroutineScope coroutineScope)
-
Method Summary
Modifier and Type Method Description final Unitfetch(Boolean isPreload)Initiates an ad fetch operation if the current state is CreatedState. final Unitload(ByteArray response)Loads an ad from the provided response data if the current state is CreatedState. final Unitinflate()Inflates the ad unit for rendering if the current state is FetchedState. UnitonLoadFailure(Short errorCode, InMobiAdRequestStatus status)Handles ad load failure events if the current state is LoadingState. UnitonUserLeftApplication()Handles user left application events if the current state is RenderedState. UnitonAdClicked(Map<Object, Object> params)Handles ad click events if the current state is RenderedState. UnitonAdImpression(TelemetryOnAdImpression telemetryOnAdImpression)Handles ad impression events if the current state is RenderedState. UnitonFetchTimeout()Handles fetch timeout events if the current state implements FetchTimeoutListener. UnitonInternalLoadTimeout()Handles internal load timeout events if the current state implements InternalLoadTimeoutListener. UnitonPreloadTimeout()Handles preload timeout events if the current state implements PreloadTimeoutListener. UnitonAdFullScreenDisplayed()Handles full screen ad display events if the current state implements FullScreenListener. UnitonAdFullScreenDismissed()Handles full screen ad dismissal events if the current state implements FullScreenListener. UnitonDestroy()Handles destruction events if the current state implements AUMDestroyListener. -
-
Method Detail
-
fetch
final Unit fetch(Boolean isPreload)
Initiates an ad fetch operation if the current state is CreatedState.
- Parameters:
isPreload- Whether this is a preload operation
-
load
final Unit load(ByteArray response)
Loads an ad from the provided response data if the current state is CreatedState.
- Parameters:
response- The ad response data as a ByteArray, or null for regular fetch
-
inflate
final Unit inflate()
Inflates the ad unit for rendering if the current state is FetchedState.
-
onLoadFailure
Unit onLoadFailure(Short errorCode, InMobiAdRequestStatus status)
Handles ad load failure events if the current state is LoadingState.
- Parameters:
errorCode- The error code associated with the failurestatus- The InMobiAdRequestStatus describing the failure
-
onUserLeftApplication
Unit onUserLeftApplication()
Handles user left application events if the current state is RenderedState.
-
onAdClicked
Unit onAdClicked(Map<Object, Object> params)
Handles ad click events if the current state is RenderedState.
- Parameters:
params- The parameters associated with the ad click
-
onAdImpression
Unit onAdImpression(TelemetryOnAdImpression telemetryOnAdImpression)
Handles ad impression events if the current state is RenderedState.
- Parameters:
telemetryOnAdImpression- Optional telemetry data for the ad impression
-
onFetchTimeout
Unit onFetchTimeout()
Handles fetch timeout events if the current state implements FetchTimeoutListener.
-
onInternalLoadTimeout
Unit onInternalLoadTimeout()
Handles internal load timeout events if the current state implements InternalLoadTimeoutListener.
-
onPreloadTimeout
Unit onPreloadTimeout()
Handles preload timeout events if the current state implements PreloadTimeoutListener.
-
onAdFullScreenDisplayed
Unit onAdFullScreenDisplayed()
Handles full screen ad display events if the current state implements FullScreenListener.
-
onAdFullScreenDismissed
Unit onAdFullScreenDismissed()
Handles full screen ad dismissal events if the current state implements FullScreenListener.
-
onDestroy
Unit onDestroy()
Handles destruction events if the current state implements AUMDestroyListener.
-
-
-
-