Report your app's own volume when it sets a mute or sound level separate from the device volume buttons. Video ads from Google can then follow that level.
This applies only to Google ads. The value is not forwarded to mediation networks.
The device volume is the output level. The app can still scale its audio below that. setAppVolume reports that relative level, from 0.0 (silent) to 1.0 (the current device volume), for app open, banner, interstitial, rewarded, and rewarded interstitial ads.
import React from 'react';
import mobileAds, { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
const adUnitId = __DEV__ ? TestIds.GAM_BANNER : '/xxx/yyyy';
function App() {
mobileAds().setAppVolume(0.5);
return <GAMBannerAd unitId={adUnitId} sizes={[BannerAdSize.FULL_BANNER]} />;
}Lowering your app's audio volume reduces video ad eligibility and might reduce your app's ad revenue. You should only use this API if your app provides custom volume controls to the user, and the user's volume is properly reflected in the API.
For App Open, Banner, Interstitial, Rewarded, and Rewarded Interstitial ad formats, you can inform the Google Mobile Ads SDK that the app volume has been muted by calling the setAppMuted function:
import React from 'react';
import mobileAds, { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
const adUnitId = __DEV__ ? TestIds.GAM_BANNER : '/xxx/yyyy';
function App() {
mobileAds().setAppMuted(true);
return <GAMBannerAd unitId={adUnitId} sizes={[BannerAdSize.FULL_BANNER]} />;
}By default, appVolume is set to 1 (the current device volume) and appMuted is set to NO.
Muting your app reduces video ad eligibility and might reduce your app's ad revenue. You should only use this API if your app provides a custom mute control to the user, and the user's mute decision is properly reflected in the API.
On iOS, video ads can change the shared AVAudioSession while they play — even when muted —
which may interrupt or pause in-page video. If your app owns the audio session, tell the SDK
before loading video ads:
import mobileAds from 'react-native-google-mobile-ads';
mobileAds().setAudioSessionIsApplicationManaged(true);This sets GADMobileAds.sharedInstance.audioVideoManager.audioSessionIsApplicationManaged
(Google-Mobile-Ads-SDK 13.10.0). When true, the SDK does not manage AVAudioSession during
ad video playback. Default is false.
This API is iOS only. Classic Android (play-services-ads 25.5.0) and Next-Gen
(ads-mobile-sdk 1.5.0) have no equivalent; calls are a no-op on Android.