The volume control APIs provided by the Google Mobile Ads SDK are intended to mirror your app’s own custom volume controls . Utilizing these APIs ensures that the user receives video ads with the expected audio volume.
We’ll talk about some best practices implementing the volume control APIs in your iOS , Android or Unity project.
Why are we mentioning this?
Publishers can lose revenue when using these APIs to lower or mute the volume of the Google Mobile Ads SDK. Two issues we have commonly seen:
Apps are using their own custom volume controls not sending the app’s accurate volume to the Google Mobile Ads SDK, but always sending zero
App are just muting the SDK
Some apps have close to a 100% mute rate which doesn’t sound correct (pun intended). Setting application volume to zero or muting the application reduces video ad eligibility, which as a result may reduce your app’s ad revenue.
Volume control APIs
The Google Mobile Ads SDK offers two volume control APIs : setting the volume and toggling mute. These APIs are applicable to App Open, Banner, Interstitial, Rewarded and Rewarded Interstitial ad formats. For Native ads, use GADVideoOptions
.
Setting application volume on each platform
iOS
GADMobileAds.sharedInstance().applicationVolume = 1.0
Android
MobileAds.setAppVolume(1.0f)
Unity
MobileAds.SetApplicationVolume(1.0f)
Use applicationVolume
to set your custom volume relative to the device volume. The range can be from 0.0 (silent) to 1.0 (current device volume). For example, if the device volume level was at half level and the user set your app’s custom volume to max level, set the applicationVolume
to 1.0
and the user will receive an ad with the volume at half level.
Setting application mute on each platform
iOS
GADMobileAds.sharedInstance().applicationMuted = true
Android
MobileAds.setAppMuted(true)
Unity
MobileAds.SetApplicationMuted(true)
Use applicationMuted
if your custom volume controls include a mute button. Only toggle applicationMuted
if the user selects your custom mute button. For example, if the user adjusts your custom volume to 0 you do not need to call applicationMuted
; just call applicationVolume = 0.0
.
Setting mute for native ads on each platform
iOS
let videoOptions = GADVideoOptions()
videoOptions.startMuted = true
adLoader = GADAdLoader(
adUnitID: "AD_UNIT_ID",
rootViewController: self,
adTypes: [ ... ad type constants ... ],
options: [videoOptions])
Android
val videoOptions = VideoOptions.Builder()
.setStartMuted(false)
.build()
val adOptions = NativeAdOptions.Builder()
.setVideoOptions(videoOptions)
.build()
val adLoader = AdLoader.Builder(this, "AD_UNIT_ID")
.forNativeAd( ... )
.withNativeAdOptions(adOptions)
.build()
Unity
N/A - Native video ads are not supported in Unity.
Use startMuted
if your custom volume controls include a mute button. Only toggle startMuted
if the user selects your custom mute button.
Best Practices
To use our APIs as intended:
applicationVolume
should be called only when your custom volume control settings are set to reflect the new volume
applicationMuted
or startMuted
should only be toggled to true
if the user has muted your custom volume
As a rule of thumb, if your app does not have custom volume controls then you should not use these APIs.
What should you do?
To verify that your mobile applications are using these APIs correctly, we recommend that you enable test ads and force load a video test ad in your application. If your app has custom volume controls, the ad’s volume should be at the same level as the custom volume. Otherwise, the ad’s volume should match the device volume.
If you have any questions or need additional help, please contact us via the forum .
- Justin Malandruccolo, Mobile Ads Developer Relations