Class FetchingState
-
- All Implemented Interfaces:
-
com.inmobi.media.ads.common.base.state.State,com.inmobi.media.ads.common.listeners.AUMDestroyListener,com.inmobi.media.ads.common.listeners.FetchTimeoutListener,com.inmobi.media.ads.common.listeners.InternalLoadTimeoutListener
public abstract class FetchingState extends AdManagerComponentWrapper implements State, FetchTimeoutListener, InternalLoadTimeoutListener, AUMDestroyListener
Represents the state when an ad unit manager is actively fetching ads from the server.
This abstract state handles the ad fetching process using AdFetchManager, manages timeout scenarios, and processes the server response. It implements multiple listener interfaces to handle fetch timeouts, internal load timeouts, and destruction events. Upon successful ad retrieval, it transitions to the next appropriate state, while failures result in transition to FetchFailedState.
-
-
Field Summary
Fields Modifier and Type Field Description private final ContextapplicationContextprivate final AdManagerContextadManagerContextprivate final CoroutineScopeadManagerScopeprivate final AdConfigadConfigprivate final PubSettingspubSettingsprivate final InMobiLoggerloggerprivate final AdLifecycleDataadLifecycleDataprivate final AdManagerTelemetryHelperadManagerTelemetryHelper
-
Constructor Summary
Constructors Constructor Description FetchingState(AdManagerComponent adManagerComponent, AUMStateMachine stateMachine, AdUnitTimeoutManager adUnitTimeout, PublisherCallbacks publisherCallbacks)
-
Method Summary
Modifier and Type Method Description Unitinitialize()Initializes the fetching state and begins the ad fetch process. UnitonInternalLoadTimeout()Handles internal load timeout during the fetch process. UnitonDestroy()Handles destruction of the ad unit manager. UnitcleanUp()Finalizes the state and cancels the child coroutine scope. UnitonFetchTimeout()Handles fetch timeout events. -
Methods inherited from class com.inmobi.media.ads.context.wrapper.AdManagerComponentWrapper
getAdConfig, getAdLifecycleData, getAdManagerContext, getAdManagerScope, getAdManagerTelemetryHelper, getApplicationContext, getLogger, getPubSettings -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
FetchingState
FetchingState(AdManagerComponent adManagerComponent, AUMStateMachine stateMachine, AdUnitTimeoutManager adUnitTimeout, PublisherCallbacks publisherCallbacks)
-
-
Method Detail
-
initialize
Unit initialize()
Initializes the fetching state and begins the ad fetch process.
This method starts the fetch operation using AdFetchManager in a coroutine, handles successful responses by calling onAdResponseParseSuccess, and manages failures through handleAdFetchFailureException.
-
onInternalLoadTimeout
Unit onInternalLoadTimeout()
Handles internal load timeout during the fetch process.
This method is called when an internal timeout occurs during ad fetching, resulting in transition to FetchFailedState with appropriate error code.
-
onDestroy
Unit onDestroy()
Handles destruction of the ad unit manager.
Transitions to DestroyedState for proper cleanup.
-
onFetchTimeout
Unit onFetchTimeout()
Handles fetch timeout events.
Called when the fetch operation times out, resulting in transition to FetchFailedState with timeout error code.
-
-
-
-