AppOpenAd

public interface AppOpenAd extends Ad


App open ads are used to monetize app load screens. Unlike interstitial ads, app open ads make it easy to provide an app branding area so that users understand the context in which they see the ad. Use load to load an AppOpenAd and then call show to display it.

Summary

Nested types

public static class AppOpenAd.Companion

Public methods

abstract AppOpenAdEventCallback

Optional callback for ad events during the lifecycle of this AppOpenAd.

default static final void
load(
    @NonNull AdRequest adRequest,
    @NonNull AdLoadCallback<@NonNull AppOpenAd> adLoadCallback
)

Loads an AppOpenAd, providing the result via adLoadCallback.

default static final void
loadFromAdResponse(
    @NonNull String adResponse,
    @NonNull AdLoadCallback<@NonNull AppOpenAd> adLoadCallback
)

Loads an AppOpenAd, providing the result via adLoadCallback.

abstract void

Optional callback for ad events during the lifecycle of this AppOpenAd.

abstract void
setImmersiveMode(boolean immersiveModeEnabled)

Sets a flag that controls if this ad will be displayed in immersive mode.

abstract void
show(@NonNull Activity activity)

Shows the 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 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 AppOpenAdEventCallback getAdEventCallback()

Optional callback for ad events during the lifecycle of this AppOpenAd.

load

default static final void load(
    @NonNull AdRequest adRequest,
    @NonNull AdLoadCallback<@NonNull AppOpenAd> adLoadCallback
)

Loads an AppOpenAd, providing the result via adLoadCallback.

Parameters
@NonNull AdRequest adRequest

An ad request with targeting information.

@NonNull AdLoadCallback<@NonNull AppOpenAd> adLoadCallback

A callback to be invoked when the ad finishes loading.

loadFromAdResponse

default static final void loadFromAdResponse(
    @NonNull String adResponse,
    @NonNull AdLoadCallback<@NonNull AppOpenAd> adLoadCallback
)

Loads an AppOpenAd, providing the result via adLoadCallback.

Parameters
@NonNull String adResponse

An ad response from a server-to-server ad request.

@NonNull AdLoadCallback<@NonNull AppOpenAd> adLoadCallback

A callback to be invoked when loading completes.

setAdEventCallback

abstract void setAdEventCallback(AppOpenAdEventCallback adEventCallback)

Optional callback for ad events during the lifecycle of this AppOpenAd.

setImmersiveMode

abstract void setImmersiveMode(boolean immersiveModeEnabled)

Sets a flag that controls if this ad will be displayed in immersive mode. Call this method before AppOpenAd.show. During AppOpenAd.show, if this flag is on and immersive mode is supported, the ad will turn on the SYSTEM_UI_FLAG_IMMERSIVE_STICKY & SYSTEM_UI_FLAG_HIDE_NAVIGATION flags.

show

abstract void show(@NonNull Activity activity)

Shows the ad.

Parameters
@NonNull Activity activity

An Activity context from which to present the ad.