אופטימיזציה של האתחול וטעינה של מודעות
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בחירת פלטפורמה:
Android
Unity
החל מגרסה 21.0.0 של Google Mobile Ads (GMA) SDK, אפשר להפעיל אתחול אופטימלי של SDK וטעינת מודעות כדי לשפר את מהירות התגובה הכוללת של המודעות ולעזור במניעת שגיאות "האפליקציה לא מגיבה" (ANR) באפליקציה. במדריך הזה מפורטים השינויים שצריך לבצע כדי להפעיל את האופטימיזציות האלה.
דרישות
- גרסה 7.2.0 ואילך של Google Mobile Ads Unity plugin.
עדכון ההגדרות של Google Mobile Ads
Google Mobile Ads SDK
מאפשר אופטימיזציה כברירת מחדל, ומורה ל-SDK לבצע את משימות ההפעלה והטעינה של המודעות בעיבוד של שרשורים ברקע.
הדגלים הבאים זמינים לאובייקט הניתן לכתיבת סקריפט של הגדרות Google Mobile Ads SDK:
Google Mobile Ads SDK
settings scriptable
object:
- השבתה של אופטימיזציית האתחול
- השבתת האופטימיזציה של טעינת מודעות
כדי להורות ל-SDK לאתחל ולטעון מודעות בשרשור הראשי, צריך לבדוק את ההגדרות הבאות:
הגדרה | התנהגות |
השבתה של אתחול Optimize |
האפשרות הזו משביתה את האופטימיזציה של קריאת האתחול MobileAds.initialize() . |
השבתת האופטימיזציה של טעינת מודעות
|
מבצע אופטימיזציה של קריאות לטעינת מודעות לכל הפורמטים של המודעות. |
משבית את האופטימיזציה של הקריאה לטעינת המודעה. |
אפשר לגשת להגדרות של Google Mobile Ads דרך תפריט הנכסים של Unity:
נכסים > Google Mobile Ads > הגדרות
אחרי הבחירה, ממשק המשתמש של ההגדרות מופיע בחלון הבדיקה של Unity Editor.

חשוב לדעת שאפשר להפעיל אחת מהאפשרויות או את שתיהן באותה אפליקציה.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-27 (שעון UTC).
[null,null,["עדכון אחרון: 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."]]