Optimize initialization and ad loading

Starting from Google Mobile Ads (GMA) SDK version 21.0.0, you can enable optimized SDK initialization and ad loading to improve the overall responsiveness of ads and help prevent "Application Not Responding" (ANR) errors on your app. This guide outlines the changes you need to make to enable these optimizations.

Requirements

  • Google Mobile Ads Unity plugin version 7.2.0 or higher.

Update your Google Mobile Ads settings

The Google Mobile Ads SDK enables optimization by default, and instructs the SDK to perform initialization and ad loading tasks processing on background threads.

The following flags are available for the Google Mobile Ads SDK settings scriptable object:

  • Disable initialization optimization
  • Disable ad loading optimization

Check these settings to instruct the SDK to initialize and load ads on the main thread:

SettingBehavior
Disable Optimize Initialization Disables optimizing the MobileAds.initialize() initialization call.
Disable ad loading optimization Optimizes ad load calls for all ad formats. Disables optimizing the ad loading call.

You can access the Google Mobile Ads settings through the Unity asset menu:

Assets > Google Mobile Ads > Settings

Once selected, the settings UI appears in your Unity Editor inspector window.

Note that you can turn on one or both options in the same app.