PictureInPictureAd

@ExperimentalApi
public interface PictureInPictureAd extends 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

Nested types

public static class PictureInPictureAd.Companion

Public methods

abstract PictureInPictureAdEventCallback

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

abstract @NonNull PictureInPictureAdPosition

The current position of the PiP ad.

abstract @NonNull PictureInPictureAdPresentationScope

The presentation scope of the PiP ad.

abstract void

Hides the PiP ad.

default static final void

Loads a PiP ad.

abstract void

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

abstract void
show(
    @NonNull Activity activity,
    @NonNull PictureInPictureAdOptions options
)

Shows the PiP ad.

Inherited methods

From com.google.android.libraries.ads.mobile.sdk.common.Ad
abstract void

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

abstract @NonNull String

The ad unit ID used to request this ad.

abstract long

An identifier for a placement in reporting.

abstract @NonNull ResponseInfo

Gets information about the ad response for this ad.

abstract void
setPlacementId(long placementId)

An identifier for a placement in reporting.

Public methods

getAdEventCallback

abstract PictureInPictureAdEventCallback getAdEventCallback()

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

getPosition

abstract @NonNull PictureInPictureAdPosition getPosition()

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

getPresentationScope

abstract @NonNull PictureInPictureAdPresentationScope getPresentationScope()

The presentation scope of the PiP ad.

hide

abstract void hide()

Hides the PiP ad.

load

default static final void load(
    @NonNull PictureInPictureAdRequest adRequest,
    @NonNull AdLoadCallback<@NonNull PictureInPictureAd> adLoadCallback
)

Loads a PiP ad.

Parameters
@NonNull PictureInPictureAdRequest adRequest

An ad request with targeting information.

@NonNull AdLoadCallback<@NonNull PictureInPictureAd> adLoadCallback

A callback to be invoked when loading completes.

setAdEventCallback

abstract void setAdEventCallback(PictureInPictureAdEventCallback adEventCallback)

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

show

abstract void show(
    @NonNull Activity activity,
    @NonNull PictureInPictureAdOptions options
)

Shows the PiP ad.

Parameters
@NonNull Activity activity

The Activity for showing the ad.

@NonNull PictureInPictureAdOptions options

Options configuring presentation scope and position for showing the ad.