Global Settings

The GADMobileAds class provides global settings for controlling certain information collected by the 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 the Google Mobile Ads SDK allows 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 the Google Mobile Ads SDK by setting the applicationVolume property. 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:

- (void)viewDidLoad {
  [super viewDidLoad];
  // Set app volume to be half of the current device volume.
  GADMobileAds.applicationVolume = 0.5;
  ...
}

To inform the Google Mobile Ads SDK that the app volume has been muted, set the applicationMuted property, as shown below:

GADMobileAds.applicationMuted = YES;

Unmuting the app volume reverts it to its previously set level. By default, the app volume for the Google Mobile Ads SDK is set to 1 (the current device volume).

Changing audio session

Audio sessions allow you to express to the system your intentions for your app's audio behavior. Additional information on audio sessions can be found in Apple's Audio Session Programming Guide. The Google Mobile Ads SDK provides a delegate method to GADBannerView and GADInterstitial, allowing these ad types to conditionally change the category for audio sessions. The default behavior is to allow category changes for audio sessions. If the delegate method is implemented, returning NO will prevent the SDK from changing the audio session category and video ads will use the current audio session settings. An implementation of ad:shouldChangeAudioSessionToCategory: is shown below:

- (BOOL)ad:(id)ad shouldChangeAudioSessionToCategory:(NSString *)audioSessionCategory {
  return YES;
}

In-app purchase reporting

To help grow your in-app purchase revenue and maximize the total revenue generated by your app, the Mobile Ads SDK now automatically collects general in-app purchase (IAP) information (such as item purchase price and currency). Now, you won't have to implement extra logic to track IAP conversions yourself. If you're an AdMob developer, we recommend that you leverage this new functionality to enjoy the benefits of AdMob's smart monetization offerings. This IAP reporting setting must always be enabled if you are running in-app purchase house ads (currently in limited beta). This is necessary for IAP house ad conversions to be reported.

In our latest SDK release, in-app purchase reporting is enabled by default. If you'd like, however, you can disable it by using the disableAutomatedInAppPurchaseReporting method (unless you are running IAP house ads, as noted above). The best moment to call this method is when the app launches:

Objective-C

AppDelegate.m
- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GADMobileAds disableAutomatedInAppPurchaseReporting];
  return YES;
}

Swift

AppDelegate.swift

func application(application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  GADMobileAds.disableAutomatedInAppPurchaseReporting()
  return true
}

Crash reporting

The Mobile Ads SDK inspects exceptions that occur in an iOS app and records them if they are caused by the SDK. These exceptions are collected so we can prevent them in future SDK versions.

In our latest SDK release, crash reporting is enabled by default. If you don't want SDK-related exceptions to be recorded, you can disable this feature by calling the disableSDKCrashReporting method. The best place to call this method is when the app launches:

Objective-C

AppDelegate.m
- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GADMobileAds disableSDKCrashReporting];
  return YES;
}

Swift

AppDelegate.swift

func application(application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  GADMobileAds.disableSDKCrashReporting()
  return true
}

Send feedback about...

AdMob by Google
AdMob by Google