AdContext

class AdContext(context: Context, activity: Activity, val uiTheme: UiTheme.Theme, val isForStories: Boolean, isMuted: Boolean, val showMuteButton: Boolean = false, val clipsActionButtonFullWidth: Boolean = false, val isEmbeddedClips: Boolean = false, val isBottomBanner: Boolean = false)

Provides contextual information required when rendering ads.

The supplied activity reference is automatically wrapped in a java.lang.ref.WeakReference so that the SDK does not prevent the hosting Activity from being garbage-collected. Always check that activity is non-null before attempting to use it.

An AdContext is created once per player session (story player open / clip screen) and shared across every ad request issued during that session. Per-request state (slot identifier, playhead signal, fill attribution, cancellation) lives on AdSlot obtained via allocateSlot.

Constructors

Link copied to clipboard
constructor(context: Context, activity: Activity, uiTheme: UiTheme.Theme, isForStories: Boolean, isMuted: Boolean, showMuteButton: Boolean = false, clipsActionButtonFullWidth: Boolean = false, isEmbeddedClips: Boolean = false, isBottomBanner: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
val cancellationSignal: CompletableJob

Cancellation signal completed by the SDK when the entire player session is dismissed.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String

Session-scoped identifier, stable for the lifetime of this AdContext.

Link copied to clipboard
Link copied to clipboard
val isBottomBanner: Boolean = false

Indicates this ad context is for a bottom banner ad in clips.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val showMuteButton: Boolean = false
Link copied to clipboard
Link copied to clipboard
val uiTheme: UiTheme.Theme

Functions

Link copied to clipboard
fun setDesignatedEntity(storyId: String? = null, pageId: String? = null, clipId: String? = null)
Link copied to clipboard
fun slotForDesignatedId(designatedId: String): AdSlot?

Returns the slot previously allocated under designatedId or null if none exists.