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
There are two optimization flags available within the Google Mobile Ads settings scriptable object: Optimize Initialization and Optimize AdLoading. Once they're turned on, the initialization and ad loading tasks that require extended processing time are offloaded to background threads.
Setting | Behavior |
---|---|
Optimize Initialization | Optimizes the MobileAds.initialize() initialization call. |
Optimize AdLoading | Optimizes ad load calls for all ad formats. |
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.