firebase:: gma:: InterstitialAd
#include <interstitial_ad.h>
Loads and displays Google Mobile Ads interstitial ads.
Summary
InterstitialAd is a single-use object that can load and show a single GMA interstitial ad.
InterstitialAd objects provide information about their current state through Futures. Initialize, LoadAd, and Show each have a corresponding Future from which you can determine result of the previous call.
Here's how one might initialize, load, and show an interstitial ad while checking against the result of the previous action at each step:
namespace gma = ::firebase::gma; gma::InterstitialAd* interstitial = new gma::InterstitialAd(); interstitial->Initialize(ad_parent);
Then, later:
if (interstitial->InitializeLastResult().status() == ::firebase::kFutureStatusComplete && interstitial->InitializeLastResult().error() == firebase::gma::kAdErrorCodeNone) { interstitial->LoadAd( "YOUR_AD_UNIT_ID", my_ad_request); }
And after that:
if (interstitial->LoadAdLastResult().status() == ::firebase::kFutureStatusComplete && interstitial->LoadAdLastResult().error() == firebase::gma::kAdErrorCodeNone)) { interstitial->Show(); }
Deprecated. The Google Mobile Ads C++ SDK is now deprecated. Please see https://developers.google.com/admob/cpp/reference/namespace/firebase/gma for more information.
Constructors and Destructors |
|
---|---|
InterstitialAd()
Creates an uninitialized InterstitialAd object.
|
|
~InterstitialAd()
|
Public functions |
|
---|---|
Initialize(AdParent parent)
|
Future< void >
Initialize the InterstitialAd object.
|
InitializeLastResult() const
|
Future< void >
Returns a Future containing the status of the last call to Initialize.
|
LoadAd(const char *ad_unit_id, const AdRequest & request)
|
Begins an asynchronous request for an ad.
|
LoadAdLastResult() const
|
|
SetFullScreenContentListener(FullScreenContentListener *listener)
|
void
Sets the FullScreenContentListener for this InterstitialAd.
|
SetPaidEventListener(PaidEventListener *listener)
|
void
Registers a callback to be invoked when this ad is estimated to have earned money.
|
Show()
|
Future< void >
Shows the InterstitialAd.
|
ShowLastResult() const
|
Future< void >
|
Public functions
Initialize
Future< void > Initialize( AdParent parent )
Initialize the InterstitialAd object.
Details | |||
---|---|---|---|
Parameters |
|
InitializeLastResult
Future< void > InitializeLastResult() const
Returns a Future containing the status of the last call to Initialize.
InterstitialAd
InterstitialAd()
Creates an uninitialized InterstitialAd object.
Initialize must be called before the object is used.
LoadAd
Future< AdResult > LoadAd( const char *ad_unit_id, const AdRequest & request )
Begins an asynchronous request for an ad.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
SetFullScreenContentListener
void SetFullScreenContentListener( FullScreenContentListener *listener )
Sets the FullScreenContentListener for this InterstitialAd.
Details | |||
---|---|---|---|
Parameters |
|
SetPaidEventListener
void SetPaidEventListener( PaidEventListener *listener )
Registers a callback to be invoked when this ad is estimated to have earned money.
Details | |||
---|---|---|---|
Parameters |
|
Show
Future< void > Show()
Shows the InterstitialAd.
This should not be called unless an ad has already been loaded.
ShowLastResult
Future< void > ShowLastResult() const
~InterstitialAd
~InterstitialAd()