AppOpenAd

public abstract class AppOpenAd 

App open ads are used to display ads when users enter your app. An AppOpenAd object contains all the data necessary to display an ad. 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 one of the static load methods to load an AppOpenAd . Then call show to render it.

Summary

Nested types

public abstract class AppOpenAd.AppOpenAdLoadCallback extends AdLoadCallback

An object for receiving event notifications for loading an app open ad.

Public constructors

Public methods

abstract @ NonNull String

Returns the ad unit ID.

abstract @ Nullable FullScreenContentCallback

Gets the FullScreenContentCallback for this AppOpenAd .

abstract @ Nullable OnPaidEventListener

Gets the OnPaidEventListener for this AppOpenAd .

abstract long

Gets the placement ID for this AppOpenAd .

abstract @ NonNull ResponseInfo

Returns the ResponseInfo for the loaded ad.

static boolean
isAdAvailable (@ NonNull Context  context, @ NonNull String  adUnitId)

This method is deprecated.

Use isAdAvailable instead.

static void
load (
Context  context,
String  adUnitId,
AdRequest  adRequest,
AppOpenAd.AppOpenAdLoadCallback  loadCallback
)

Loads an AppOpenAd .

static @ Nullable AppOpenAd
pollAd (@ NonNull Context  context, @ NonNull String  adUnitId)

This method is deprecated.

Use pollAd instead.

abstract void
setFullScreenContentCallback (
    @ Nullable FullScreenContentCallback  fullScreenContentCallback
)

Registers a callback to be invoked when ads show and dismiss full screen content.

abstract void
setImmersiveMode (boolean immersiveModeEnabled)

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

abstract void

Registers a callback to be invoked when this ad is estimated to have earned money.

abstract void
setPlacementId (long placementId)

Sets a placement ID for the app open ad.

abstract void
show (@ NonNull Activity  activity)

Shows the AppOpenAd.

Public constructors

AppOpenAd

public  AppOpenAd 
()

Public methods

getAdUnitId

public abstract @ NonNull 
 String 
 getAdUnitId 
()

Returns the ad unit ID.

getFullScreenContentCallback

public abstract @ Nullable 
 FullScreenContentCallback 
 getFullScreenContentCallback 
()

Gets the FullScreenContentCallback for this AppOpenAd .

getOnPaidEventListener

public abstract @ Nullable 
 OnPaidEventListener 
 getOnPaidEventListener 
()

Gets the OnPaidEventListener for this AppOpenAd .

getPlacementId

public abstract long  getPlacementId 
()

Gets the placement ID for this AppOpenAd .

getResponseInfo

public abstract @ NonNull 
 ResponseInfo 
 getResponseInfo 
()

Returns the ResponseInfo for the loaded ad.

isAdAvailable

public static boolean    isAdAvailable 
 
 
(@ NonNull 
 Context 
 context, @ NonNull 
 String 
 adUnitId)

Returns true if there is an available app open ad loaded from startPreload .

load

public static void  load 
(
Context  context,
String  adUnitId,
AdRequest  adRequest,
AppOpenAd.AppOpenAdLoadCallback  loadCallback
)

Loads an AppOpenAd .

Parameters
Context  context

The context.

String  adUnitId

The ad unit ID.

AdRequest  adRequest

An ad request with targeting information.

AppOpenAd.AppOpenAdLoadCallback  loadCallback

An object that handles events for loading an app open ad.

pollAd

public static @ Nullable 
 AppOpenAd 
   pollAd 
 
 
(@ NonNull 
 Context 
 context, @ NonNull 
 String 
 adUnitId)

Retrieves the next app open ad loaded from startPreload , or null if no ad is available.

setFullScreenContentCallback

public abstract void  setFullScreenContentCallback 
(
    @ Nullable FullScreenContentCallback  fullScreenContentCallback
)

Registers a callback to be invoked when ads show and dismiss full screen content.

setImmersiveMode

public abstract void  setImmersiveMode 
(boolean immersiveModeEnabled)

Sets a flag that controls if this app open ad object will be displayed in immersive mode. Call this method before show . During show time, if this flag is on and immersive mode is supported, SYSTEM_UI_FLAG_IMMERSIVE_STICKY &SYSTEM_UI_FLAG_HIDE_NAVIGATION will be turned on for the app open ad.

setOnPaidEventListener

public abstract void  setOnPaidEventListener 
(@ Nullable 
 OnPaidEventListener 
 listener)

Registers a callback to be invoked when this ad is estimated to have earned money.

setPlacementId

public abstract void  setPlacementId 
(long placementId)

Sets a placement ID for the app open ad.

To ensure this placement ID is included in reporting, call this method before showing the ad.

Parameters
long placementId

A long integer provided by the AdMob UI for the configured placement.

show

public abstract void  show 
(@ NonNull 
 Activity 
 activity)

Shows the AppOpenAd.

Parameters
@ NonNull Activity  activity

The activity from which the AppOpenAd is shown from.

Create a Mobile Website
View Site in Mobile | Classic
Share by: