Class AdSessionManager

  • All Implemented Interfaces:
    com.inmobi.media.ads.common.omid.base.AdSessionManagerInterface , com.inmobi.media.ads.common.omid.base.ClickEventAdSessionInterface , com.inmobi.media.ads.common.omid.base.DisplayAdEventsInterface , com.inmobi.media.ads.common.omid.base.VideoAdEventsInterface

    
    public abstract class AdSessionManager
     implements AdSessionManagerInterface, DisplayAdEventsInterface, VideoAdEventsInterface
                        

    Abstract base class for managing OMID ad sessions with comprehensive lifecycle management.

    This class provides the foundation for OMID-compliant ad session management, integrating display and video ad event tracking capabilities. It handles the creation, configuration, and lifecycle management of OMID ad sessions while providing thread-safe operations using coroutines for main thread execution.

    The class manages core OMID components including AdSession, MediaEvents, and AdEvents instances, ensuring proper initialization and cleanup throughout the ad lifecycle.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Boolean isSessionActive() DI-19121: true while a created/started OM-SDK AdSession has not been finished.
      abstract Unit initializeAdSession(String omsdkScript, List<OmidTracker> omidTrackers, Map<String, String> macros, String contentUrl, String customReferenceData, Boolean isolateVerificationScripts) Initializes the OMID ad session with the provided configuration and verification data.
      Unit startAdSession() Starts the ad session.
      Unit stopAdSession() Stops the ad session.
      Unit stopAdSessionFromMain() Stops the ad session from the main thread.
      Unit registerAdView(View adView) Registers a view on which to track viewability.
      Unit addObstruction(View childView, FriendlyObstructionPurpose friendlyObstruction) Adds a friendly obstruction.
      Unit removeObstruction(View childView) Removes a friendly obstruction.
      Unit registerImpression() Signals the impression event occurring.
      Unit trackAdUserInteractionEvent(InteractionType type) Tracks a user interaction event with the ad content.
      • Methods inherited from class com.inmobi.media.ads.common.omid.base.DisplayAdEventsInterface

        displayAdLoaded
      • Methods inherited from class com.inmobi.media.ads.common.omid.base.VideoAdEventsInterface

        nonSkippableVideoAdLoaded, skippableVideoAdLoaded, trackAdVideoEvent
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AdSessionManager

        AdSessionManager(CoroutineScope coroutineScope, InMobiLogger logger)
        Parameters:
        coroutineScope - The CoroutineScope used for managing coroutine-based operations
    • Method Detail

      • isSessionActive

         final Boolean isSessionActive()

        DI-19121: true while a created/started OM-SDK AdSession has not been finished.

      • initializeAdSession

        @MainThread() abstract Unit initializeAdSession(String omsdkScript, List<OmidTracker> omidTrackers, Map<String, String> macros, String contentUrl, String customReferenceData, Boolean isolateVerificationScripts)

        Initializes the OMID ad session with the provided configuration and verification data.

        This abstract method must be implemented by concrete subclasses to handle the specific initialization requirements for different ad session types (native, web, etc.). It should create and configure the ad session with the provided OMID verification scripts and tracking information.

        Parameters:
        omsdkScript - The OMSDK JavaScript verification script content
        omidTrackers - List of OmidTracker instances containing verification partner information
        macros - Map of macro keys to values for URL template replacement
        contentUrl - The URL of the ad content being measured (nullable)
        customReferenceData - Custom reference data for verification purposes
        isolateVerificationScripts - Whether to isolate verification scripts from each other
      • startAdSession

         Unit startAdSession()

        Starts the ad session. This must be called after the ad session is created.

      • stopAdSession

         Unit stopAdSession()

        Stops the ad session. This should be called when the ad is finished.

      • stopAdSessionFromMain

         Unit stopAdSessionFromMain()

        Stops the ad session from the main thread.

        This method should be called from the main thread to safely terminate the ad session, ensuring that all UI-related operations are handled appropriately.

      • registerAdView

         Unit registerAdView(View adView)

        Registers a view on which to track viewability.

        Parameters:
        adView - View on which to track viewability.
      • addObstruction

         Unit addObstruction(View childView, FriendlyObstructionPurpose friendlyObstruction)

        Adds a friendly obstruction.

        Parameters:
        childView - The View representing the friendly obstruction
        friendlyObstruction - The friendly obstruction to add.
      • removeObstruction

         Unit removeObstruction(View childView)

        Removes a friendly obstruction.

        Parameters:
        childView - The friendly obstruction to remove.
      • registerImpression

         Unit registerImpression()

        Signals the impression event occurring. Generally accepted to be on ad render.

      • trackAdUserInteractionEvent

         Unit trackAdUserInteractionEvent(InteractionType type)

        Tracks a user interaction event with the ad content.

        This method should be called when a user interacts with an ad through clicks, taps, or other interaction types as defined by the OMID standard. The interaction type helps classify the nature of the user engagement for measurement purposes.

        Parameters:
        type - The InteractionType representing the specific type of user interaction