PictureInPictureAd

@ExperimentalApi
interface PictureInPictureAd : Ad


Represents a picture-in-picture (PiP) ad.

A PiP ad displays as a small, draggable, floating window that snaps to one of the four corners of the screen. The ad can be scoped to a single activity or persist globally across the app.

Summary

Public companion functions

suspend AdLoadResult<PictureInPictureAd>

Loads a PiP ad, suspending until a PictureInPictureAd successfully loads or fails to load.

Unit
load(
    adRequest: PictureInPictureAdRequest,
    adLoadCallback: AdLoadCallback<PictureInPictureAd>
)

Loads a PiP ad.

Public functions

Unit

Hides the PiP ad.

Unit
show(activity: Activity, options: PictureInPictureAdOptions)

Shows the PiP ad.

Public properties

PictureInPictureAdEventCallback?

The callback for receiving Picture-in-Picture ad lifecycle events.

PictureInPictureAdPosition

The current position of the PiP ad.

PictureInPictureAdPresentationScope

The presentation scope of the PiP ad.

Inherited functions

From com.google.android.libraries.ads.mobile.sdk.common.Ad
Unit

Destroys the ad, stopping any extra processing and destroying resources associated with the ad.

ResponseInfo

Gets information about the ad response for this ad.

Inherited properties

From com.google.android.libraries.ads.mobile.sdk.common.Ad
String

The ad unit ID used to request this ad.

Long

An identifier for a placement in reporting.

Public companion functions

load

suspend fun load(adRequest: PictureInPictureAdRequest): AdLoadResult<PictureInPictureAd>

Loads a PiP ad, suspending until a PictureInPictureAd successfully loads or fails to load.

Parameters
adRequest: PictureInPictureAdRequest

An ad request with targeting information.

Returns
AdLoadResult<PictureInPictureAd>

AdLoadResult.Success if the load succeeded, AdLoadResult.Failure otherwise.

load

fun load(
    adRequest: PictureInPictureAdRequest,
    adLoadCallback: AdLoadCallback<PictureInPictureAd>
): Unit

Loads a PiP ad.

Parameters
adRequest: PictureInPictureAdRequest

An ad request with targeting information.

adLoadCallback: AdLoadCallback<PictureInPictureAd>

A callback to be invoked when loading completes.

Public functions

hide

fun hide(): Unit

Hides the PiP ad.

show

fun show(
    activity: Activity,
    options: PictureInPictureAdOptions = PictureInPictureAdOptions.Builder().build()
): Unit

Shows the PiP ad.

Parameters
activity: Activity

The Activity for showing the ad.

options: PictureInPictureAdOptions = PictureInPictureAdOptions.Builder().build()

Options configuring presentation scope and position for showing the ad.

Public properties

adEventCallback

var adEventCallback: PictureInPictureAdEventCallback?

The callback for receiving Picture-in-Picture ad lifecycle events.

position

val position: PictureInPictureAdPosition

The current position of the PiP ad. Value is PictureInPictureAdPosition.DEFAULT until the ad is assigned a position.

presentationScope

val presentationScope: PictureInPictureAdPresentationScope

The presentation scope of the PiP ad.