Global Settings
The MobileAds class provides global settings for Google Mobile Ads SDK.
Video ad volume control
If your app has its own volume controls, such as custom music or sound effect volumes, disclosing app volume to Google Mobile Ads SDK enables video ads to respect app volume settings. This ensures users receive video ads with the expected audio volume.
The device volume, controlled through volume buttons or OS-level volume slider, determines the volume for device audio output. However, apps can independently adjust volume levels relative to the device volume to tailor the audio experience.
You can report the relative app volume to Google Mobile Ads SDK by calling the set_app_volume() method before loading the ad. Valid ad volume values range from 0.0 (silent) to 1.0 (current device volume). Here's an example of how to report the relative app volume to the SDK:
Warning
Lowering your app's audio volume reduces video ad eligibility and might reduce your app's ad revenue. You should only utilize this method if your app provides custom volume controls to the user, and the user's volume is properly reflected in the app.
To inform the SDK that the app volume has been muted, call the set_app_muted() method before loading the ad:
By default, the app volume is set to 1, the current device volume, and the app is not muted.
Warning
Muting your app reduces video ad eligibility and might reduce your app's ad revenue. You should only utilize this method if your app provides a custom mute control to the user, and the user's mute decision is properly reflected in the app.
Consent for cookies
If your app has special requirements, you can set the optional gad_has_consent_for_cookies key to zero to enable limited ads:
Disable crash reporting
Google Mobile Ads SDK collects crash reports for debugging and analysis purposes. To disable crash reporting, see the following sections for Android and iOS.
Add the <meta-data> tag with DISABLE_CRASH_REPORTING set to true in your app's AndroidManifest.xml file:
Get plugin version
To get the plugin version, run the following:
Get platform version
The Google Mobile Ads SDK depends on the Android and iOS platform SDKs. To get the version of the platform SDK, run the following: