GoogleMobileAds.Api.MobileAds

Contains logic that applies to the Google Mobile Ads SDK as a whole.

Summary

Properties

Instance
static MobileAds
The MobileAds static instance.
RaiseAdEventsOnUnityMainThread
static bool
Determines whether ad events raised by the Google Mobile Ads Unity plugin should be invoked on the Unity main thread.

Public static functions

DisableMediationInitialization()
void
Call before MobileAds.Initialize(Action{InitializationStatus}) to disable mediation adapter initialization.
GetRequestConfiguration()
Gets the global RequestConfiguration.
Initialize(Action< InitializationStatus > initCompleteAction)
void
Initializes the Google Mobile Ads SDK.
OpenAdInspector(Action< AdInspectorError > adInspectorClosedAction)
void
Opens ad inspector UI.
SetApplicationMuted(bool muted)
void
Sets whether the app's audio is muted.
SetApplicationVolume(float volume)
void
Sets the app's audio volume.
SetRequestConfiguration(RequestConfiguration requestConfiguration)
void
Sets the global RequestConfiguration that is used for every AdRequest during the app's session.
SetiOSAppPauseOnBackground(bool pause)
void
Indicates if the Unity app should be paused when a full-screen ad is displayed.

Classes

GoogleMobileAds.Api.MobileAds.Utils

Contains methods for returning the device scale and safe width.

Properties

Instance

static MobileAds Instance

The MobileAds static instance.

RaiseAdEventsOnUnityMainThread

static bool RaiseAdEventsOnUnityMainThread

Determines whether ad events raised by the Google Mobile Ads Unity plugin should be invoked on the Unity main thread.

The default value is false.

Public static functions

DisableMediationInitialization

void DisableMediationInitialization()

Call before MobileAds.Initialize(Action{InitializationStatus}) to disable mediation adapter initialization.

Warning: Calling this method might negatively impact your mediation performance. This method should only be called if you include mediation adapters in your app, but you don't plan on using Google mediation during this app session (for example, you are running an A/B test).

GetRequestConfiguration

RequestConfiguration GetRequestConfiguration()

Gets the global RequestConfiguration.

Details
Returns
The global configuration that is used for every AdRequest.

Initialize

void Initialize(
  Action< InitializationStatus > initCompleteAction
)

Initializes the Google Mobile Ads SDK.

Call this method before loading an ad and before interacting with the rest of the Google Mobile Ads SDK.

Details
Parameters
initCompleteAction
An action which is invoked after initialization is complete. Includes the InitializationStatus of the SDK as a parameter.

OpenAdInspector

void OpenAdInspector(
  Action< AdInspectorError > adInspectorClosedAction
)

Opens ad inspector UI.

Details
Parameters
adInspectorClosedAction
Called when ad inspector UI closes.

SetApplicationMuted

void SetApplicationMuted(
  bool muted
)

Sets whether the app's audio is muted.

Affects initial mute state for all ads.

Warning: Muting your app reduces video ad eligibility and might reduce your app's ad revenue. Use this API only if your app provides a custom mute control and reflects the user's mute decision through the API.

Details
Parameters
muted
True if the app is muted, false otherwise. Defaults to false.

SetApplicationVolume

void SetApplicationVolume(
  float volume
)

Sets the app's audio volume.

Affects audio volumes of all ads relative to other audio output.

Warning: Lowering your app's audio volume reduces video ad eligibility and might reduce your app's ad revenue. Use this API only if your app provides custom volume control and reflects the user's volume choice through the API.

Details
Parameters
volume
The volume as a float from 0 (muted) to 1.0 (full media volume). Defaults to 1.0.

SetRequestConfiguration

void SetRequestConfiguration(
  RequestConfiguration requestConfiguration
)

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

Details
Parameters
requestConfiguration
The global configuration that is used for every AdRequest.

SetiOSAppPauseOnBackground

void SetiOSAppPauseOnBackground(
  bool pause
)

Indicates if the Unity app should be paused when a full-screen ad is displayed.

On Android, Unity is paused when displaying full-screen ads. Calling this method with true duplicates this behavior on iOS.

Details
Parameters
pause
True if iOS should pause the app when backgrounded. Default is false.