Interface ViewabilityManager

  • All Implemented Interfaces:

    
    public interface ViewabilityManager<T extends Object>
    
                        

    Generic interface for managing viewability tracking of different types of trackable objects.

    This interface provides a contract for implementing viewability measurement systems that can track when views or other trackable elements meet specific viewability criteria. It supports generic types to allow for different kinds of viewability events or data to be emitted through the tracking flow.

    The interface follows a standard lifecycle pattern for tracking systems: start → pause/resume → stop, enabling efficient resource management and battery optimization for long-running viewability measurements.

    Implementations should handle viewability calculations based on criteria such as percentage visible, time in view, and minimum dimensions according to industry standards (IAB, MRC) or custom requirements.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Flow<T> startTracking() Starts viewability tracking and returns a flow of viewability events.
      abstract Unit pause() Pauses viewability tracking while maintaining the current tracking state.
      abstract Unit resume() Resumes viewability tracking from a paused state.
      abstract Unit stop() Stops viewability tracking and releases all associated resources.
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • startTracking

         abstract Flow<T> startTracking()

        Starts viewability tracking and returns a flow of viewability events.

        This method initiates the viewability tracking process and returns a Flow that emits events when the tracked element meets the defined viewability criteria. The flow provides a reactive way to handle viewability events throughout the tracking lifecycle.

        Returns:

        A Flow that emits viewability events of type T

      • pause

         abstract Unit pause()

        Pauses viewability tracking while maintaining the current tracking state.

        This method temporarily suspends viewability measurement without losing the current tracking context. It's useful for scenarios where tracking should be temporarily disabled (e.g., app backgrounding) but may be resumed later without restarting the entire tracking process.

      • resume

         abstract Unit resume()

        Resumes viewability tracking from a paused state.

        This method restarts viewability measurement after it has been paused, continuing from the previous tracking state. The tracking process should seamlessly continue without losing accumulated viewability data or context.

      • stop

         abstract Unit stop()

        Stops viewability tracking and releases all associated resources.

        This method terminates the viewability tracking process completely and should clean up all resources including observers, timers, and background tasks. After calling stop, the tracker should not emit any further events and startTracking should be called to begin tracking again.