firebase:: gma

API for Google Mobile Ads with Firebase.

Summary

The GMA API allows you to load and display mobile ads using the Google Mobile Ads SDK. Each ad format has its own header file.

Deprecated. The Google Mobile Ads (GMA) C++ SDK is deprecated as of June 17, 2024 and should not be adopted in projects that don't already use it. It will enter End-of-Maintenance (EoM) on June 17, 2025. Note that versions of the SDK released before the EoM date will continue to function, but no further bug fixes or changes will be released after the EoM date.

Instead of the Google Mobile Ads C++ SDK, consider using the iOS and Android SDKs from AdMob. For support, reach out to the Google Mobile Ads SDK Technical Forum .

Typedefs

typedef
void *
This is a platform specific datatype that is required to create a Google Mobile Ads ad.

Functions

void
Disables mediation adapter initialization on iOS during initialization of the GMA SDK.
void
Disables automated SDK crash reporting on iOS.
Get the current adapter initialization status.
Initialize (const :: firebase::App & app, InitResult *init_result_out)
Deprecated. The Google Mobile Ads C++ SDK is now deprecated. Please see the SDK reference documentation for more information.
Initializes Google Mobile Ads (GMA) via Firebase.
Initialize (JNIEnv *jni_env, jobject activity, InitResult *init_result_out)
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.
Initializes Google Mobile Ads (GMA) without Firebase for Android.
Initialize (InitResult *init_result_out)
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.
Initializes Google Mobile Ads (GMA) without Firebase for iOS.
void
Opens the ad inspector UI.
SetIsSameAppKeyEnabled (bool is_enabled)
void
Controls whether the Google Mobile Ads SDK Same App Key is enabled.
SetRequestConfiguration (const RequestConfiguration & request_configuration)
void
Sets the global RequestConfiguration that will be used for every AdRequest during the app's session.
void
Terminate GMA.

Classes

Information about why an ad operation failed.

Listener to be invoked when the Ad Inspector has been closed.

A listener for receiving notifications during the lifecycle of a BannerAd.

Contains targeting information used to fetch an ad.

Information about the result of an ad operation.

Describes a reward credited to a user for interacting with a RewardedAd .

The size of a banner ad.

The monetary value earned from an ad.

Loads and displays Google Mobile Ads AdView ads.

A listener class that developers can extend and pass to an AdView object's AdView::SetBoundingBoxListener method to be notified of changes to the size of the Ad's bounding box.

An immutable snapshot of the GMA SDK’s initialization status, categorized by mediation adapter.

Response information for an individual ad network contained within a ResponseInfo object.

A snapshot of a mediation adapter's initialization status.

Listener to be invoked when ads show and dismiss full screen content, such as a fullscreen ad experience or an in-app browser.

Loads and displays Google Mobile Ads interstitial ads.

Listener to be invoked when ads have been estimated to earn money.

Information about an ad response.

Loads and displays Google Mobile Ads rewarded ads.

Listener to be invoked when the user earned a reward.

Structs

The screen location and dimensions of an AdView once it has been initialized.

Global configuration that will be used for every AdRequest .

Namespaces

API for User Messaging Platform.

Enumerations

AdErrorCode

  
 AdErrorCode 

Error codes returned by Future::error().

Properties

Will not send request because the ad object has already been used.

An attempt to load an Ad Network extras class for an ad request has failed.

The ad is not ready to be shown.

Ad is too large for the scene.

The ad is already initialized (repeat call).

The ad can not be shown when app is not in the foreground.

Will not send request because the application identifier is missing.

Error processing image url.

The request to show the Ad Inspector failed because it's already open.

An attempt to load the Ad Inspector failed.

A call to load an ad has failed due to an internal SDK error.

Will not send request because the interstitial object has already been used.

Android Ad String is invalid.

Invalid argument error.

A call to load an ad has failed due to an invalid request.

A call has failed because an ad is currently loading.

Error finding or creating a mediation ad network adapter.

The mediation response was invalid.

Attempting to pass an invalid ad size to an adapter.

A mediation ad network adapter received an ad request, but did not fill.

The adapter’s error is included as an underlyingError.

A mediation adapter failed to show the ad.

A call to load an ad has failed due to a network error.

A call to load an ad has failed because no ad was available to serve.

An attempt has been made to show an ad on an Android Activity that has no window token (such as one that's not done initializing).

Call completed successfully.

A debug operation failed because the device is not in test mode.

Attempted to present ad from a non-main thread.

This is an internal error which should be reported to support if encountered.

The current device’s OS is below the minimum required version.

Received invalid response.

Will not send a request because the rewarded ad object has already been used.

The ad server experienced a failure processing the request.

The request was unable to be loaded before being timed out.

The ad has not been fully initialized.

Fallback error for any unidentified cases.

Typedefs

AdParent

 void 
  
 * 
  
 AdParent 

This is a platform specific datatype that is required to create a Google Mobile Ads ad.

The following defines the datatype on each platform:

  • Android: A jobject which references an Android Activity.
  • iOS: An id which references an iOS UIView.
A void pointer for stub classes.

Functions

DisableMediationInitialization

 void 
  
 DisableMediationInitialization 
 () 

Disables mediation adapter initialization on iOS during initialization of the GMA SDK.

Calling this method may negatively impact your ad performance and should only be called if you will not use GMA SDK controlled mediation during this app session. This method must be called before initializing the GMA SDK or loading ads and has no effect once the SDK has been initialized.

This method has no effect on Android.

DisableSDKCrashReporting

 void 
  
 DisableSDKCrashReporting 
 () 

Disables automated SDK crash reporting on iOS.

If not called, the SDK records the original exception handler if available and registers a new exception handler. The new exception handler only reports SDK related exceptions and calls the recorded original exception handler.

This method has no effect on Android.

GetInitializationStatus

  AdapterInitializationStatus 
 
  
 GetInitializationStatus 
 () 

Get the current adapter initialization status.

You can poll this method to check which adapters have been initialized.

GetRequestConfiguration

  RequestConfiguration 
 
  
 GetRequestConfiguration 
 () 

Gets the global RequestConfiguration .

Details
Returns
the currently active RequestConfiguration that's being used for every ad request.

Initialize

  Future 
 
 < 
  
  AdapterInitializationStatus 
 
  
 > 
  
 Initialize 
 ( 
  
 const 
  
 :: 
  firebase 
 :: 
 App 
 
  
 & 
  
 app 
 , 
  
 InitResult 
  
 * 
 init_result_out 
 ) 

Initializes Google Mobile Ads (GMA) via Firebase.

Deprecated. The Google Mobile Ads C++ SDK is now deprecated. Please see the SDK reference documentation for more information.

Details
Parameters
app
The Firebase app for which to initialize mobile ads.
init_result_out
Optional: If provided, write the basic init result here. kInitResultSuccess if initialization succeeded, or kInitResultFailedMissingDependency on Android if Google Play services is not available on the current device and the Google Mobile Ads SDK requires Google Play services (for example, when using 'play-services-ads-lite'). Note that this does not include the adapter initialization status, which is returned in the Future .
Returns
If init_result_out is kInitResultSuccess, this Future will contain the initialization status of each adapter once initialization is complete. Otherwise, the returned Future will have kFutureStatusInvalid.

Initialize

  Future 
 
 < 
  
  AdapterInitializationStatus 
 
  
 > 
  
 Initialize 
 ( 
  
 JNIEnv 
  
 * 
 jni_env 
 , 
  
 jobject 
  
 activity 
 , 
  
 InitResult 
  
 * 
 init_result_out 
 ) 

Initializes Google Mobile Ads (GMA) without Firebase for Android.

The arguments to Initialize are platform-specific so the caller must do something like this:

 #if defined(__ANDROID__) 
 firebase 
 :: 
 gma 
 :: 
 Initialize 
 ( 
 jni_env 
 , 
  
 activity 
 ); 
 #else 
 firebase 
 :: 
 gma 
 :: 
 Initialize 
 (); 
 #endif 

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.

Details
Parameters
jni_env
JNIEnv pointer.
activity
Activity used to start the application.
init_result_out
Optional: If provided, write the basic init result here. kInitResultSuccess if initialization succeeded, or kInitResultFailedMissingDependency on Android if Google Play services is not available on the current device and the Google Mobile Ads SDK requires Google Play services (for example, when using 'play-services-ads-lite'). Note that this does not include the adapter initialization status, which is returned in the Future .
Returns
If init_result_out is kInitResultSuccess, this Future will contain the initialization status of each adapter once initialization is complete. Otherwise, the returned Future will have kFutureStatusInvalid.

Initialize

  Future 
 
 < 
  
  AdapterInitializationStatus 
 
  
 > 
  
 Initialize 
 ( 
  
 InitResult 
  
 * 
 init_result_out 
 ) 

Initializes Google Mobile Ads (GMA) without Firebase for iOS.

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.

Details
Parameters
init_result_out
Optional: If provided, write the basic init result here. kInitResultSuccess if initialization succeeded, or kInitResultFailedMissingDependency on Android if Google Play services is not available on the current device and the Google Mobile Ads SDK requires Google Play services (for example, when using 'play-services-ads-lite'). Note that this does not include the adapter initialization status, which is returned in the Future .
Returns
If init_result_out is kInitResultSuccess , this Future will contain the initialization status of each adapter once initialization is complete. Otherwise, the returned Future will have kFutureStatusInvalid .

InitializeLastResult

  Future 
 
 < 
  
  AdapterInitializationStatus 
 
  
 > 
  
 InitializeLastResult 
 () 

Get the Future returned by a previous call to firebase::gma::Initialize() .

OpenAdInspector

 void 
  
 OpenAdInspector 
 ( 
  
  AdParent 
 
  
 parent 
 , 
  
  AdInspectorClosedListener 
 
  
 * 
 listener 
 ) 

Opens the ad inspector UI.

Details
Parameters
parent
The platform-specific UI element that will host the ad inspector. For iOS this should be the window's UIViewController . For Android this is the Activity Context which the GMA SDK is running in.
listener
The listener will be invoked when the user closes the ad inspector UI. firebase::gma::Initialize() . must be called prior to this function.

SetIsSameAppKeyEnabled

 void 
  
 SetIsSameAppKeyEnabled 
 ( 
  
 bool 
  
 is_enabled 
 ) 

Controls whether the Google Mobile Ads SDK Same App Key is enabled.

This function must be invoked after GMA has been initialized. The value set persists across app sessions. The key is enabled by default.

This operation is supported on iOS only. This is a no-op on Android systems.

Details
Parameters
is_enabled
whether the Google Mobile Ads SDK Same App Key is enabled.

SetRequestConfiguration

 void 
  
 SetRequestConfiguration 
 ( 
  
 const 
  
  RequestConfiguration 
 
  
 & 
  
 request_configuration 
 ) 

Sets the global RequestConfiguration that will be used for every AdRequest during the app's session.

Details
Parameters
request_configuration
The request configuration that should be applied to all ad requests.

Terminate

 void 
  
 Terminate 
 () 

Terminate GMA.

Frees resources associated with GMA that were allocated during firebase::gma::Initialize() .

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