AI-generated Key Takeaways
-
Starting with Google Mobile Ads SDK version 21.0.0, you can optimize SDK initialization and ad loading to enhance ad responsiveness and mitigate ANR errors.
-
This optimization is achieved through two flags within the Google Mobile Ads settings: "Optimize Initialization" and "Optimize AdLoading", which offload time-consuming tasks to background threads.
-
To enable these optimizations, you need to update your Google Mobile Ads Unity plugin to version 7.2.0 or higher and adjust the settings via the Unity asset menu (Assets > Google Mobile Ads > Settings).
-
By default, both optimization flags are set to
false
, allowing you to selectively enable them based on your app's needs.
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.