Class NativeRenderedState
-
- All Implemented Interfaces:
-
com.inmobi.media.ads.common.base.state.State,com.inmobi.media.ads.common.listeners.AUDestroyListener,com.inmobi.media.ads.nativeAd.listeners.UnTrackListener
public final class NativeRenderedState extends AdComponentWrapper implements State, UnTrackListener, AUDestroyListener
Represents the rendered state of a native ad unit. This state is reached when the native ad has been successfully loaded and the publisher has registered views for tracking. It handles impression tracking, click events, viewability measurement, and media events.
-
-
Field Summary
Fields Modifier and Type Field Description private final ContextapplicationContextprivate final CoroutineScopeadManagerScopeprivate final AdContextadContextprivate final AdConfigadConfigprivate final PubSettingspubSettingsprivate final AdContext.ViewabilityContextviewabilityprivate final AdMetaInfoadMetaInfoprivate final MetaInfometaInfoprivate final InMobiLoggerloggerprivate final AdLifecycleDataadLifecycleDataprivate final AdManagerTelemetryHelperadManagerTelemetryHelper
-
Constructor Summary
Constructors Constructor Description NativeRenderedState(NativeRenderedStateProvider provider, NativeAdUnitStateMachine stateMachine)
-
Method Summary
Modifier and Type Method Description Unitinitialize()Initializes the rendered state by setting up tracking, event listeners, and starting impression and viewability measurements. UnitunTrackViews()Transitions the ad unit to the untracked state. final UnittakeAction()Handles user actions (such as clicks) on the native ad. UnitcleanUp()Finalizes the rendered state by cleaning up resources and stopping tracking. UnitonDestroy()Handles the destruction of the native ad unit in the rendered state. -
Methods inherited from class com.inmobi.media.ads.context.wrapper.AdComponentWrapper
getAdConfig, getAdContext, getAdLifecycleData, getAdManagerScope, getAdManagerTelemetryHelper, getAdMetaInfo, getApplicationContext, getLogger, getMetaInfo, getPubSettings, getViewability -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
NativeRenderedState
NativeRenderedState(NativeRenderedStateProvider provider, NativeAdUnitStateMachine stateMachine)
- Parameters:
provider- The state provider containing all necessary dependencies and managers.stateMachine- The state machine managing the lifecycle transitions.
-
-
Method Detail
-
initialize
Unit initialize()
Initializes the rendered state by setting up tracking, event listeners, and starting impression and viewability measurements.
-
unTrackViews
Unit unTrackViews()
Transitions the ad unit to the untracked state.
This method is called when the publisher wants to stop tracking the ad views, typically when the views are no longer visible or relevant. It pauses media operations, detaches observers, and creates a new untracked state while preserving essential components like ad choice and media view for potential future re-tracking.
-
takeAction
final Unit takeAction()
Handles user actions (such as clicks) on the native ad. This method triggers the landing page handler to process the action.
-
onDestroy
Unit onDestroy()
Handles the destruction of the native ad unit in the rendered state.
This method performs cleanup operations specific to the rendered state before transitioning to the destroyed state. It detaches click listeners, destroys media components, handles contextual data cleanup, and ensures proper state transition to prevent memory leaks.
-
-
-
-