Stay organized with collectionsSave and categorize content based on your preferences.
The IMA SDK loads dependencies to request ads, measure viewability and
report ad impressions. By initializing IMA before you make an ad request, you
maximize the time to load IMA dependencies before ad playback. This page covers
how to handling IMA load times in your app.
CallImaSdkFactory.initialize()
TheImaSdkFactory.initialize()method starts to preload SDK resources in advance of the first ad request. To
useinitialize(), you need IMA version 3.35.1 or higher.
CallImaSdkFactory.initialize()on application startup, or as early in the
application's lifecycle as your app structure allows. Theinitialize()call
takes the following parameters:
context: Uses the application context, which is always available during
the lifecycle of the application.
settings: Pass the anImaSdkSettingsobject with its values set. The IMA settings used in theinitialize()call
must be the same as the settings values used in thecreateAdsLoader()call. The IMA SDK utilizes these settings, particularly the language setting,
for cache key. We don't recommend using test or fake values for the settings
used in theinitialize()method call, as cache misses might occur and
increase ad load time.
Reuse theAdsLoaderinstance
To improve IMA load time, we recommend you reuse the sameAdsLoaderinstance. TheAdsLoaderinterface can handle multiple ad or stream requests.
Avoid creating a newAdsLoaderinstance for each request. Creating a newAdsLoaderinstance requires a load time, and uses additional device resources.
Request ads in advance of playback
If you have access to theAdsLoaderinstance prior to starting ad playback,
you can also call theAdsLoader.requestAds()method early. Making this call starts loading pre-roll ads. When the user
is ready to start content playback, call theAdsManager.init()method and wait for theLOADEDevent to play ads.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Improve IMA load time\n\nThe IMA SDK loads dependencies to request ads, measure viewability and\nreport ad impressions. By initializing IMA before you make an ad request, you\nmaximize the time to load IMA dependencies before ad playback. This page covers\nhow to handling IMA load times in your app.\n\nCall `ImaSdkFactory.initialize()`\n---------------------------------\n\nThe\n[`ImaSdkFactory.initialize()`](/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory#initialize(android.content.Context,com.google.ads.interactivemedia.v3.api.ImaSdkSettings))\nmethod starts to preload SDK resources in advance of the first ad request. To\nuse `initialize()`, you need IMA version 3.35.1 or higher.\n\nCall `ImaSdkFactory.initialize()` on application startup, or as early in the\napplication's lifecycle as your app structure allows. The `initialize()` call\ntakes the following parameters:\n\n- **`context`**: Uses the application context, which is always available during the lifecycle of the application.\n- **`settings`** : Pass the an [`ImaSdkSettings`](/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings) object with its values set. The IMA settings used in the `initialize()` call must be the same as the settings values used in the `createAdsLoader()` call. The IMA SDK utilizes these settings, particularly the language setting, for cache key. We don't recommend using test or fake values for the settings used in the `initialize()` method call, as cache misses might occur and increase ad load time.\n\nReuse the `AdsLoader` instance\n------------------------------\n\nTo improve IMA load time, we recommend you reuse the same\n[`AdsLoader`](/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader)\ninstance. The `AdsLoader` interface can handle multiple ad or stream requests.\nAvoid creating a new `AdsLoader` instance for each request. Creating a new\n`AdsLoader` instance requires a load time, and uses additional device resources.\n\nRequest ads in advance of playback\n----------------------------------\n\nIf you have access to the `AdsLoader` instance prior to starting ad playback,\nyou can also call the\n[`AdsLoader.requestAds()`](/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader#requestAds(com.google.ads.interactivemedia.v3.api.AdsRequest))\nmethod early. Making this call starts loading pre-roll ads. When the user\nis ready to start content playback, call the\n[`AdsManager.init()`](/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/BaseManager#init())\nmethod and wait for the `LOADED` event to play ads."]]