Optimiser l'initialisation et le chargement des annonces
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Sélectionnez une plate-forme :
Android
Unity
À partir de la version 21.0.0 du SDK Google Mobile Ads (GMA), vous pouvez activer l'initialisation optimisée du SDK et le chargement des annonces pour améliorer la réactivité globale des annonces et éviter les erreurs Application ne répond pas (ANR) dans votre application.
Ce guide décrit les modifications que vous devez apporter pour activer ces optimisations.
Conditions requises
- Plug-in Google Mobile Ads Unity 7.2.0 ou version ultérieure.
Modifier vos paramètres Google Mobile Ads
Le SDK Google Mobile Ads
permet l'optimisation par défaut et indique au SDK d'effectuer les tâches d'initialisation et de chargement d'annonces sur des threads en arrière-plan.
Les indicateurs suivants sont disponibles pour l'objet scriptable des paramètres du SDK Google Mobile Ads :
- Désactiver l'optimisation de l'initialisation
- Désactiver l'optimisation du chargement des annonces
Vérifiez ces paramètres pour demander au SDK d'initialiser et de charger les annonces sur le thread principal :
Paramètre | Comportement |
Désactiver l'initialisation d'Optimize |
Désactive l'optimisation de l'appel d'initialisation MobileAds.initialize() . |
Désactiver l'optimisation du chargement des annonces
|
Optimise les appels de chargement d'annonces pour tous les formats d'annonces. |
Désactive l'optimisation de l'appel de chargement des annonces. |
Vous pouvez accéder aux paramètres Google Mobile Ads via le menu des ressources Unity :
Assets > Google Mobile Ads > Settings
Une fois sélectionnée, l'interface utilisateur des paramètres s'affiche dans la fenêtre de l'inspecteur de l'éditeur Unity.

Notez que vous pouvez activer l'une ou l'autre de ces options, ou les deux, dans la même application.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/27 (UTC).
[null,null,["Dernière mise à jour le 2025/08/27 (UTC)."],[[["\u003cp\u003eStarting 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.\u003c/p\u003e\n"],["\u003cp\u003eThese optimizations are enabled through two flags within the Google Mobile Ads settings: \u003cstrong\u003eOptimize Initialization\u003c/strong\u003e and \u003cstrong\u003eOptimize AdLoading\u003c/strong\u003e, which offload time-consuming tasks to background threads.\u003c/p\u003e\n"],["\u003cp\u003eYou can access and modify these settings via the Unity asset menu: \u003cstrong\u003eAssets > Google Mobile Ads > Settings\u003c/strong\u003e, enabling either or both options based on your needs.\u003c/p\u003e\n"],["\u003cp\u003eBy default, both optimization flags are set to \u003ccode\u003efalse\u003c/code\u003e, requiring you to manually enable them to leverage these improvements.\u003c/p\u003e\n"]]],["Optimized SDK initialization and ad loading can be enabled in Google Mobile Ads (GMA) SDK version 21.0.0 and higher, preventing \"Application Not Responding\" (ANR) errors. To activate, update to Google Mobile Ads Unity plugin version 7.2.0 or higher. In Unity's **Assets \u003e Google Mobile Ads \u003e Settings**, enable **Optimize Initialization** and/or **Optimize AdLoading**. These settings offload initialization and ad loading to background threads. Both flags are `false` by default.\n"],null,["# Optimize initialization and ad loading\n\nSelect platform: [Android](/admob/android/optimize-initialization \"View this page for the Android platform docs.\") [Unity](/admob/unity/optimize-initialization \"View this page for the Unity platform docs.\")\n\n\u003cbr /\u003e\n\nStarting from Google Mobile Ads (GMA) SDK version 21.0.0, you can enable\noptimized SDK initialization and ad loading to improve the overall\nresponsiveness of ads and help prevent [\"Application Not Responding\"\n(ANR)](//developer.android.com/topic/performance/vitals/anr) errors on your app.\nThis guide outlines the changes you need to make to enable these optimizations.\n\nRequirements\n------------\n\n- Complete the [Get Started guide](/admob/unity/quick-start).\n\n\u003c!-- --\u003e\n\n- Google Mobile Ads Unity plugin version 7.2.0 or higher.\n\nUpdate your Google Mobile Ads settings\n--------------------------------------\n\nThe\n\nGoogle Mobile Ads SDK\n\nenables optimization by default, and instructs the SDK to\nperform initialization and ad loading tasks processing on background threads.\n\nThe following flags are available for the\n\nGoogle Mobile Ads SDK\n\nsettings scriptable\nobject:\n\n- Disable initialization optimization\n- Disable ad loading optimization\n\nCheck these settings to instruct the SDK to initialize and load ads on the main\nthread:\n\n| Setting | Behavior |\n|---------------------------------|-----------------------------------------------------------------------|------------------------------------------|\n| Disable Optimize Initialization | Disables optimizing the `MobileAds.initialize()` initialization call. |\n| Disable ad loading optimization | Optimizes ad load calls for all ad formats. | Disables optimizing the ad loading call. |\n\nYou can access the Google Mobile Ads settings through the Unity asset menu:\n\n**Assets \\\u003e Google Mobile Ads \\\u003e Settings**\n\nOnce selected, the settings UI appears in your Unity Editor inspector window.\n\nNote that you can turn on one or both options in the same app."]]