AI-generated Key Takeaways
-
Optimized SDK initialization and ad loading, available in Google Mobile Ads (GMA) SDK version 21.0.0 and higher, improve ad responsiveness and help prevent ANR errors.
-
To enable these optimizations in Unity, you need Google Mobile Ads Unity plugin version 7.2.0 or higher and must have completed the Get Started guide.
-
The Google Mobile Ads SDK enables optimization by default, performing tasks on background threads, but you can disable optimizations to process on the main thread using settings.
-
You can access and modify Google Mobile Ads settings, including disabling initialization or ad loading optimization, through the Unity asset menu: Assets > Google Mobile Ads > Settings.
-
It is possible to enable or disable one or both optimization options within the same app.
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
- Complete the Get Started guide.
- 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:
Setting | Behavior | |
---|---|---|
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.