### start (with callback) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/AdPreloader?hl=pl Starts preloading ads with a callback. ```APIDOC ## POST /start (with callback) ### Description Starts preloading ads for the given `PreloadConfiguration` + `preloadId` and returns `true`. ### Method `public boolean start(@NonNull String preloadId, @NonNull PreloadConfiguration preloadConfiguration, PreloadCallback preloadCallback)` ### Parameters #### Path Parameters * **preloadId** (`String`) - Required - The ID for this preload operation. * **preloadConfiguration** (`PreloadConfiguration`) - Required - The configuration for preloading. * **preloadCallback** (`PreloadCallback`) - Optional - The callback to be notified of preloading events. ### Response #### Success Response (200) * **boolean** - Returns `true` if preloading started successfully. ``` -------------------------------- ### start Method for DisplayOpenMeasurement (Kotlin | Java) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/DisplayOpenMeasurement Starts Open Measurement viewability measurements for display ads. This is an abstract method within the DisplayOpenMeasurement interface. ```kotlin abstract fun start() ``` ```java abstract void start() ``` -------------------------------- ### Handle Page Started in H5AdsWebViewClient Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/h5/H5AdsWebViewClient Callback invoked when the WebView starts loading a page. Useful for initiating actions before page content is available. ```kotlin open fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?): Unit ``` -------------------------------- ### start (with callback) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/AdPreloader?hl=tr Starts preloading ads for a given preload ID, configuration, and callback. ```APIDOC ## POST /start ### Description Starts preloading ads for the given `PreloadConfiguration` + `preloadId` and returns `true`. ### Method POST ### Endpoint `/start` ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **preloadId** (String) - Required - The ID for the preload operation. - **preloadConfiguration** (Object) - Required - The configuration for preloading ads. - **preloadCallback** (Object) - Required - The callback to be notified of preload events. ``` -------------------------------- ### start(preloadId, preloadConfiguration) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/AdPreloader?hl=it Starts the ad preloading process without a callback mechanism. ```APIDOC ## Method: start(preloadId, preloadConfiguration) ### Description Starts preloading ads based on the provided configuration without requiring a callback. ### Method Java Method ### Parameters #### Path Parameters - **preloadId** (String) - Required - A unique identifier for the preloading session. - **preloadConfiguration** (PreloadConfiguration) - Required - The configuration settings for the ad buffer. ### Response - **boolean** - Returns true if the preloading process was successfully initiated, false otherwise. ``` -------------------------------- ### Start Preloading Ads (Kotlin/Java) Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/appopen/AppOpenAdPreloader.Companion Initiates the preloading of ads for a given preload ID and configuration without requiring a callback. Returns true if preloading was successfully started. ```kotlin open fun start(preloadId: String, preloadConfiguration: PreloadConfiguration): Boolean ``` -------------------------------- ### start(preloadId, preloadConfiguration, preloadCallback) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/AdPreloader?hl=it Starts the ad preloading process with a callback to monitor ad availability and status changes. ```APIDOC ## Method: start(preloadId, preloadConfiguration, preloadCallback) ### Description Starts preloading ads for the given configuration and ID. The SDK maintains the buffer size specified in the configuration and triggers callbacks for success or failure events. ### Method Java Method ### Parameters - **preloadId** (String) - Required - A unique identifier for the preloading session. - **preloadConfiguration** (PreloadConfiguration) - Required - The configuration settings for the ad buffer. - **preloadCallback** (PreloadCallback) - Optional - Callback invoked when ad availability changes. ### Response - **boolean** - Returns true if the preloading process started, false if the configuration was already active. ``` -------------------------------- ### start (no callback) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/AdPreloader?hl=pl Starts preloading ads without a callback. ```APIDOC ## POST /start (no callback) ### Description Starts preloading without a callback. ### Method `public abstract boolean start(@NonNull String preloadId, @NonNull PreloadConfiguration preloadConfiguration)` ### Parameters #### Path Parameters * **preloadId** (`String`) - Required - The ID for this preload operation. * **preloadConfiguration** (`PreloadConfiguration`) - Required - The configuration for preloading. ### Response #### Success Response (200) * **boolean** - Returns `true` if preloading started successfully. ``` -------------------------------- ### public static boolean start() Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/banner/BannerAdPreloader.Companion Initializes the ad preloading process for a specific configuration and identifier. ```APIDOC ## [METHOD] start ### Description Starts preloading ads for the given `PreloadConfiguration` and `preloadId`. The SDK maintains a buffer of ads as specified in the configuration and provides callbacks for success or failure events. ### Method Static Java Method ### Endpoint `public static boolean start(String preloadId, PreloadConfiguration preloadConfiguration, PreloadCallback preloadCallback)` ### Parameters #### Path Parameters - **preloadId** (String) - Required - A unique identifier for the configuration and ad format. - **preloadConfiguration** (PreloadConfiguration) - Required - The configuration object defining buffer size and other settings. - **preloadCallback** (PreloadCallback) - Optional - Callback interface for ad availability updates. ### Request Example ```java boolean started = AdPreloader.start( "my_ad_unit_id", config, new PreloadCallback() { ... } ); ``` ### Response #### Success Response (boolean) - **result** (boolean) - Returns `true` if preloading started successfully, `false` if the `preloadId` was already active. #### Response Example ```json true ``` ``` -------------------------------- ### Get Start Padding - Java Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/BaseAdAssetViewContainer?hl=vi Retrieves the start padding of the view, respecting the layout direction. This is an integer value. ```java int getPaddingStart(); ``` -------------------------------- ### Get Drawing Time in Android Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=th Gets the time elapsed since the view started drawing. This can be used for animation timing or performance analysis. ```java long getDrawingTime() ``` -------------------------------- ### POST /initialize Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/gms/ads/mediation/Adapter Initializes the third-party adapter and SDK with the provided context and configuration. ```APIDOC ## POST /initialize ### Description Called by the Google Mobile Ads SDK to initialize a third-party adapter and SDK. This method is invoked shortly after the app initializes the Google Mobile Ads SDK. ### Method POST ### Parameters #### Request Body - **context** (Context) - Required - The context provided in MobileAds.initialize() - **callback** (InitializationCompleteCallback) - Required - Callback invoked when initialization finishes. - **configurations** (List) - Required - List of configuration objects from the AdMob/Ad Manager UI. ### Response #### Success Response (200) - **void** - Initialization completed successfully. ### Response Example { "status": "initialized" } ``` -------------------------------- ### Get Padding Start - Android View Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/banner/AdView?hl=zh-tw Retrieves the padding value for the start of the view, respecting layout direction. This is an integer value. ```java int getPaddingStart() { // Implementation details... return 0; // Example return value } ``` -------------------------------- ### Core Initialization Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=id This section details the initialization process for the AdMob SDK, comparing the old method signature with the new GMA Next-Gen SDK signature, including the use of InitializationConfig. ```APIDOC ## MobileAds Initialization ### Description Initializes the MobileAds SDK. The GMA Next-Gen SDK introduces an `InitializationConfig` for more granular control. ### Method `MobileAds.initialize() ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Start Padding - Java Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/banner/AdView?hl=ar Returns the padding value for the start edge of the view. This respects the layout direction (LTR or RTL). ```Java int getPaddingStart() { // Implementation details... } ``` -------------------------------- ### Core Initialization Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=es This section details the initialization methods for the AdMob SDK, comparing the old and new SDK signatures for core initialization and configuration. ```APIDOC ## Core Initialization ### Description This section details the initialization methods for the AdMob SDK, comparing the old and new SDK signatures for core initialization and configuration. ### Method N/A (Conceptual mapping, not direct API calls) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## MobileAds Initialization ### Description Initializes the Mobile Ads SDK. The GMA Next-Gen SDK introduces an `InitializationConfig` for more advanced configuration. ### Method N/A (Conceptual mapping) ### Endpoint N/A ### Parameters #### Old SDK Method Signature - `Context context` - The application context. - `OnInitializationCompleteListener listener` - Callback for initialization completion. #### GMA Next-Gen SDK Method Signature - `Context context` - The application context. - `InitializationConfig config` - Configuration object for initialization. - `OnInitializationCompleteListener listener` - Callback for initialization completion. ### Request Example N/A ### Response N/A ## InitializationConfig Builder ### Description Provides a builder pattern for creating `InitializationConfig` objects in the GMA Next-Gen SDK. ### Method N/A (Conceptual mapping) ### Endpoint N/A ### Parameters #### GMA Next-Gen SDK Method Signature - `String applicationId` - The application ID for initialization. ### Request Example N/A ### Response N/A ``` -------------------------------- ### Initialization Configuration and Status Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/initialization/package-summary?hl=ko Overview of the classes and interfaces used to configure the SDK initialization process and monitor adapter status. ```APIDOC ## SDK Initialization Reference ### Description This module provides the necessary components to initialize the GMA Next-Gen SDK, configure session-level settings, and track the status of mediation adapters. ### Interfaces - **AdapterStatus**: An immutable snapshot of a mediation adapter's initialization status. - **InitializationStatus**: The current status of the SDK initialization. - **OnAdapterInitializationCompleteListener**: Callback interface invoked when adapter initialization completes. ### Classes - **InitializationConfig**: Class for configuring the initialization process and session-level settings. - **InitializationConfig.Builder**: Builder pattern implementation for constructing an `InitializationConfig` object. ### Enums - **AdapterStatus.InitializationState**: Represents the various states of an adapter's initialization process. ### Usage Example ```java InitializationConfig config = new InitializationConfig.Builder() .build(); MobileAds.initialize(context, config, initializationStatus -> { // Handle initialization completion }); ``` ``` -------------------------------- ### Get Drawing Time (Java) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=ja Gets the time elapsed since the view started drawing. This can be used for performance profiling or animation timing. ```java long getDrawingTime() ``` -------------------------------- ### Get Start Padding - Java Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/BaseAdAssetViewContainer?hl=zh-cn Retrieves the padding on the start side of the view, respecting layout direction. This is equivalent to left padding in LTR layouts. ```java int getPaddingStart() { // Implementation details... return 0; // Example value } ``` -------------------------------- ### SDK Initialization Interfaces and Classes Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/initialization/package-summary?hl=fr Overview of the core components for initializing the GMA Next-Gen SDK, including status tracking and configuration builders. ```APIDOC ## SDK Initialization Components ### Description This module provides the necessary interfaces and classes to initialize the Mobile Ads SDK, track adapter status, and configure session-level settings. ### Interfaces - **AdapterStatus**: An immutable snapshot of a mediation adapter's initialization status. - **InitializationStatus**: The status of the SDK initialization. - **OnAdapterInitializationCompleteListener**: Callback interface invoked when adapter initialization completes. ### Classes - **InitializationConfig**: Class for configuring the initialization process and session-level settings. - **InitializationConfig.Builder**: Builder pattern implementation for constructing an `InitializationConfig` object. ### Enums - **AdapterStatus.InitializationState**: Represents the current state of an adapter's initialization. ### Usage Example ```kotlin val config = InitializationConfig.Builder() .build() MobileAds.initialize(context, config) { status -> // Handle initialization completion } ``` ``` -------------------------------- ### Get View Padding Start (Int) Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView Returns the padding value for the start edge of the view, respecting the current layout direction (LTR or RTL). ```java getPaddingStart() ``` -------------------------------- ### Core Initialization Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=hi This section covers the initialization process for the AdMob SDK, including the `MobileAds.initialize` method and the `InitializationConfig` builder. ```APIDOC ## MobileAds Initialization ### Description Initializes the Mobile Ads SDK. The GMA Next-Gen SDK introduces `InitializationConfig` for more granular control. ### Method `MobileAds.initialize(Context context, InitializationConfig config, OnInitializationCompleteListener listener)` ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A (Initialization is asynchronous) #### Response Example N/A --- ## InitializationConfig Builder ### Description Used to build the `InitializationConfig` object for initializing the Mobile Ads SDK. ### Method `InitializationConfig.Builder(String applicationId)` ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get View's Start Padding Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=de Retrieves the padding value for the start edge of the view. This respects the view's layout direction (LTR or RTL). ```java int getPaddingStart() {} ``` -------------------------------- ### start Function for Open Measurement (Kotlin | Java) Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/nativead/DisplayOpenMeasurement The `start` function, also part of the `DisplayOpenMeasurement` interface, initiates the Open Measurement viewability measurements for display ads. It should be called after `setView` has been used to set the target view. ```kotlin fun start(): Unit ``` ```java void start() ``` -------------------------------- ### Get Padding Start - Android View Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/banner/AdView?hl=tr Retrieves the padding value for the start of the view (which corresponds to left or right depending on layout direction). Returns an integer. ```java int getPaddingStart() { // ... implementation details ... return 0; // Example return value } ``` -------------------------------- ### Initialize Mobile Ads with Next-Gen SDK Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=he Demonstrates the updated initialization method for the GMA Next-Gen SDK, which now requires an InitializationConfig object. This replaces the legacy method that only accepted a context and listener. ```java InitializationConfig config = new InitializationConfig.Builder("YOUR_APP_ID").build(); MobileAds.initialize(context, config, listener); ``` -------------------------------- ### Get Padding Start - Java Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/MediaView?hl=fr Returns the padding value for the start edge of the view. This is equivalent to left padding in LTR layouts and right padding in RTL layouts. ```java int getPaddingStart() { // Implementation details not provided in the source text. return 0; // Placeholder return value } ``` -------------------------------- ### Initialize MobileAds with Configuration Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=bn Demonstrates the updated initialization pattern for the GMA Next-Gen SDK, which now requires an InitializationConfig object. This replaces the legacy method that only accepted a context and listener. ```java MobileAds.initialize(context, new InitializationConfig.Builder("YOUR_APP_ID").build(), listener); ``` -------------------------------- ### H5AdsWebViewClient Initialization and Configuration (Kotlin) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/h5/H5AdsWebViewClient Demonstrates how to initialize and configure an H5AdsWebViewClient in Kotlin. It includes enabling JavaScript, creating the H5AdsWebViewClient instance, optionally setting a delegate WebViewClient, and assigning it to the WebView. ```kotlin fun onCreate(savedInstanceState: Bundle?) { ... // JavaScript must be enabled. val myWebView = findViewById(R.id.my_webview) myWebView.settings.javascriptEnabled = true val h5Client = H5AdsWebViewClient(this, myWebView) // (Optional) Add existing WebViewClient as delegate val myClient = ... h5Client.setDelegateWebViewClient(myClient) webView.setWebViewClient(h5Client); } ``` -------------------------------- ### Get Drawing Time Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/banner/AdView Retrieves the time elapsed since the view started drawing. Returns a Long value. ```kotlin val drawingTime: Long = view.drawingTime ``` -------------------------------- ### Start Preloading (With Callback) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/AdPreloader?hl=ar Starts preloading ads with a callback to monitor ad availability changes. This method allows for real-time updates on preloading status. ```APIDOC ## start ### Description Starts preloading ads for the given `PreloadConfiguration` and `preloadId`. The SDK attempts to keep a buffer of ads full and provides callbacks for preloading events. ### Method `public boolean start(@NonNull String preloadId, @NonNull PreloadConfiguration preloadConfiguration, PreloadCallback preloadCallback)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters Details - **`preloadId`** (`@NonNull String`) - A unique identifier for this preload configuration and ad format. Used for subsequent calls like `pollAd` or `destroy`. - **`preloadConfiguration`** (`@NonNull PreloadConfiguration`) - The configuration object specifying how to preload ads (e.g., buffer size). - **`preloadCallback`** (`PreloadCallback`) - An interface to receive callbacks when ad availability changes (e.g., `onAdPreloaded`, `onAdFailedToPreload`). ### Request Example ```java // Example usage (assuming preloadId, preloadConfiguration, and preloadCallback are defined) boolean started = adManager.start(preloadId, preloadConfiguration, preloadCallback); ``` ### Response #### Success Response (boolean) - `true` if preloading was successfully initiated. - `false` if a preload configuration with the same `preloadId` was already started (no-op). #### Response Example ```json { "started": true } ``` ### Error Handling - The SDK includes retry logic for failed ad requests. - If a `PreloadConfiguration` was already started with the same `preloadId`, this method returns `false` and performs no action. ``` -------------------------------- ### GMA Next-Gen SDK Core Methods Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=ko Documentation for initializing the SDK and configuring ad requests using the Next-Gen patterns. ```APIDOC ## MobileAds.initialize ### Description Initializes the GMA SDK with the required configuration. ### Method Static Method ### Parameters - **context** (Context) - Required - The application context. - **config** (InitializationConfig) - Required - Configuration object built via InitializationConfig.Builder. - **listener** (OnInitializationCompleteListener) - Required - Callback for initialization completion. ### Request Example MobileAds.initialize(context, new InitializationConfig.Builder("app_id").build(), listener); --- ## AdRequest.Builder ### Description Constructs an ad request for specific ad formats. ### Method Builder Pattern ### Parameters - **adUnitId** (String) - Required - The unique ad unit identifier. - **adSize** (AdSize) - Optional - Required for Banner ads. - **nativeAdTypes** (List) - Optional - Required for Native ads. ### Request Example // Banner Ad Request BannerAdRequest.Builder("ad_unit_id", AdSize.BANNER).build(); ``` -------------------------------- ### Get Drawing Time Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/common/BaseAdAssetViewContainer Retrieves the time elapsed since the view started drawing. This can be used for animation timing or performance analysis. ```kotlin open Long getDrawingTime() ``` -------------------------------- ### Initialize Mobile Ads with Next-Gen SDK Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=fr Demonstrates the updated initialization method for the GMA Next-Gen SDK, which now requires an InitializationConfig object. This ensures proper configuration before ad loading begins. ```Java InitializationConfig config = new InitializationConfig.Builder("YOUR_APP_ID").build(); MobileAds.initialize(context, config, initializationStatus -> { // Initialization complete }); ``` -------------------------------- ### Get View Padding End and Start (Java) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/MediaView?hl=it Retrieves the padding values for the View at the start and end edges, respecting the current layout direction. These methods are important for supporting right-to-left layouts correctly, ensuring consistent padding regardless of text direction. ```java int getPaddingEnd() { // Implementation details... return 0; } int getPaddingStart() { // Implementation details... return 0; } ``` -------------------------------- ### Get Call To Action String (Java) Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/iconad/IconAd Retrieves the ad's call to action text, such as 'Buy' or 'Install'. This property is nullable. ```java String getCallToAction() ``` -------------------------------- ### Get Call To Action String (Kotlin) Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/iconad/IconAd Retrieves the ad's call to action text, such as 'Buy' or 'Install'. This property is nullable. ```kotlin val callToAction: String? ``` -------------------------------- ### Context Menus and Actions Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/BaseAdAssetViewContainer?hl=pl Methods for showing context menus and starting actions. ```APIDOC ## Context Menus and Actions ### Description Methods to display context-sensitive menus and initiate ActionMode. ### Methods - `showContextMenu()` - `showContextMenu(float p0, float p1)` - `startActionMode(@NonNull ActionMode.Callback p0)` - `startActionMode(@NonNull ActionMode.Callback p0, int p1)` ### Parameters - `p0`: The `ActionMode.Callback` to handle the action mode. - `p1`: A flag indicating how the action mode should be started. ### Request Example ```java // Show context menu at touch coordinates view.showContextMenu(event.getX(), event.getY()); // Start an action mode ActionMode.Callback callback = new ActionMode.Callback() { // ... implementation ... }; view.startActionMode(callback); ``` ### Response #### Success Response (boolean / @NonNull ActionMode) - `showContextMenu()`: Returns `true` if the context menu was shown, `false` otherwise. - `showContextMenu(float p0, float p1)`: Returns `true` if the context menu was shown, `false` otherwise. - `startActionMode(...)`: Returns the started `ActionMode` instance. ``` -------------------------------- ### Start Ad Preloading (With Callback) (Kotlin/Java) Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/common/AdPreloader Starts preloading ads with a specified configuration, preload ID, and a callback to handle preloading events. Returns true if the process was initiated. ```kotlin open fun start( preloadId: String, preloadConfiguration: PreloadConfiguration, preloadCallback: PreloadCallback? ): Boolean ``` ```java open fun start( String preloadId, PreloadConfiguration preloadConfiguration, PreloadCallback preloadCallback ): boolean ``` -------------------------------- ### InitializationCompleteCallback Interface Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/gms/ads/mediation/package-summary?hl=ja Interface for mediation adapters to report the initialization status of third-party ad networks. ```APIDOC ## Interface InitializationCompleteCallback ### Description Used by mediation adapters to communicate the initialization status of a third-party ad network back to the Google Mobile Ads SDK. ### Method N/A (Interface) ### Endpoint com.google.android.gms.ads.mediation.InitializationCompleteCallback ### Parameters #### Request Body - **onInitializationSucceeded** (void) - Called when the adapter has successfully initialized. - **onInitializationFailed** (void) - Called when the adapter failed to initialize. ### Response #### Success Response (200) - **status** (string) - The initialization result status. ``` -------------------------------- ### Get SDK Version Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/MobileAds.Companion Retrieves the external version of the Google Mobile Ads SDK. The version is returned as a VersionInfo object, for example, '20.6.0'. ```java static final @NonNull VersionInfo getVersion() ``` -------------------------------- ### Get SDK Version (Kotlin) Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/MobileAds?hl=it Retrieves the external version of the Google Mobile Ads SDK, for example, '20.6.0'. This function returns a VersionInfo object. ```kotlin val versionInfo = MobileAds.getVersion() ``` -------------------------------- ### Manage SDK Configuration and Status Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/MobileAds?hl=fa Methods to retrieve SDK initialization status, global request configurations, and version information. ```kotlin fun getInitializationStatus(): InitializationStatus fun getRequestConfiguration(): RequestConfiguration fun getVersion(): VersionInfo fun setRequestConfiguration(requestConfiguration: RequestConfiguration): Unit ``` -------------------------------- ### Get SDK Version (Java) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/MobileAds?hl=ar Retrieves the external version of the Google Mobile Ads SDK. The version is returned as a VersionInfo object, for example, '20.6.0'. ```java VersionInfo version = MobileAds.getVersion(); ``` -------------------------------- ### Get Scroll Bar Default Delay - Java Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/BaseAdAssetViewContainer?hl=zh-cn Retrieves the default delay before the scroll bar starts fading. This controls the visibility duration of the scroll bar. ```java int getScrollBarDefaultDelayBeforeFade() { // Implementation details... return 0; // Example value } ``` -------------------------------- ### POST /start Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/banner/BannerAdPreloader.Companion Initiates the preloading process for ads based on a specific configuration and identifier. ```APIDOC ## POST /start ### Description Starts preloading ads for the given `PreloadConfiguration` and `preloadId`. The SDK maintains the ad buffer size defined in the configuration throughout the session. ### Method POST ### Endpoint /start ### Parameters #### Request Body - **preloadId** (String) - Required - A unique identifier for the preloading session. - **preloadConfiguration** (PreloadConfiguration) - Required - The configuration object defining buffer size and ad settings. - **preloadCallback** (PreloadCallback) - Optional - Callback interface for ad availability events. ### Request Example { "preloadId": "banner_ad_unit_01", "preloadConfiguration": { "bufferSize": 5 }, "preloadCallback": "callback_instance" } ### Response #### Success Response (200) - **result** (Boolean) - Returns true if preloading started successfully, false if the ID is already in use. #### Response Example { "result": true } ``` -------------------------------- ### Get Scroll Bar Default Delay Before Fade - Java Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/BaseAdAssetViewContainer?hl=vi Retrieves the default delay before the scroll bar starts to fade out. This is an integer value in milliseconds. ```java int getScrollBarDefaultDelayBeforeFade(); ``` -------------------------------- ### Configuring Ad Request Parameters Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/iconad/IconAdRequest.Builder Examples of using builder methods to set targeting, content URLs, and image downloading preferences. ```java builder.setContentUrl("https://example.com/content"); builder.putCustomTargeting("gender", "male"); builder.disableImageDownloading(); ``` -------------------------------- ### Get Scroll Bar Default Delay Before Fade - Android View Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/banner/AdView?hl=tr Retrieves the default delay in milliseconds before the scroll bar starts to fade out. Returns an integer. ```java int getScrollBarDefaultDelayBeforeFade() { // ... implementation details ... return 0; // Example return value } ``` -------------------------------- ### InitializationStatus Interface Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/initialization/package-summary?hl=id Defines the status of the SDK initialization process. ```APIDOC ## Interface InitializationStatus ### Description The status of the SDK initialization. ### Method N/A (Interface) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### InitializationStatus Interface Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/initialization/package-summary?hl=id Defines the status of the SDK initialization process. ```APIDOC ## Interface InitializationStatus ### Description The status of the SDK initialization. ### Method N/A (Interface definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### Get Call to Action Text Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/iconad/IconAd Retrieves the call to action string for the icon ad. This text typically prompts the user to take a specific action, such as 'Buy' or 'Install'. ```Java abstract String getCallToAction() The ad's call to action (such as "Buy" or "Install"). ``` -------------------------------- ### Get Call to Action for NativeAd Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAd Retrieves the call to action text for the native ad, such as 'Buy' or 'Install'. This method returns a String representing the desired user action. ```Java abstract String getCallToAction() ``` -------------------------------- ### InitializationStatus Interface Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/initialization/package-summary?hl=pt-br Defines the status of the SDK initialization process. ```APIDOC ## Interface InitializationStatus ### Description The status of the SDK initialization. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (N/A) - **getAdapterStatusMap** (Map) - A map where keys are adapter class names and values are their respective initialization statuses. #### Response Example ```json { "adapterStatusMap": { "com.example.adapter.MyAdapter": { "initializationState": "READY", "latency": 150 } } } ``` ``` -------------------------------- ### Classes Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/gms/ads/package-summary?hl=ar Core classes for handling ads, configuration, and video playback. ```APIDOC ## Classes `AdError` Error information about why an ad operation failed. `AdSize` The size of a banner ad. `MediaContent` `RequestConfiguration` Global configuration that will be used for every ad request. `VersionInfo` Version information. `VideoController` An object that provides playback control for video ads. `VideoController.VideoLifecycleCallbacks` Callback for receiving updates on video ad lifecycle events. `VideoOptions` Options for controlling video playback in supported ad formats. `VideoOptions.Builder` Builder for `VideoOptions`. `MediationUtils` `MobileAds` This class is present only for compatibility with mediation adapters. ``` -------------------------------- ### Get Padding and Fading Edge Properties - Android View Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=pl Provides methods to get the padding values for each side of the view (top, bottom, left, right, start, end) and the length of horizontal fading edges. Padding is the space between the view's content and its border, while fading edges provide visual cues for scrollable content. ```java int getPaddingBottom() int getPaddingEnd() int getPaddingLeft() int getPaddingRight() int getPaddingStart() int getPaddingTop() int getHorizontalFadingEdgeLength() float getLeftFadingEdgeStrength() float getRightFadingEdgeStrength() ``` -------------------------------- ### POST /initialize Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/MobileAds?hl=it Initializes the Google Mobile Ads SDK synchronously. ```APIDOC ## POST initialize ### Description Initializes the Google Mobile Ads SDK synchronously. Requires internet permissions. ### Method POST ### Endpoint MobileAds.initialize(context: Context, initializationConfig: InitializationConfig, listener: OnAdapterInitializationCompleteListener?) ### Parameters #### Request Body - **context** (Context) - Required - The application context. - **initializationConfig** (InitializationConfig) - Required - Configuration settings for the SDK. - **listener** (OnAdapterInitializationCompleteListener) - Optional - Callback for initialization completion. ### Request Example { "context": "ApplicationContext", "initializationConfig": { "appId": "ca-app-pub-xxx~yyy" } } ### Response #### Success Response (200) - **status** (Unit) - SDK initialization process triggered. ``` -------------------------------- ### Get Scroll Bar Default Delay Before Fade - Android View Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/banner/AdView?hl=zh-tw Retrieves the default delay in milliseconds before the scroll bar starts to fade out after scrolling stops. This is an integer value. ```java int getScrollBarDefaultDelayBeforeFade() { // Implementation details... return 0; // Example return value } ``` -------------------------------- ### POST /initialize Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/MobileAds?hl=pt-br Initializes the Google Mobile Ads SDK synchronously. ```APIDOC ## POST initialize ### Description Initializes the Google Mobile Ads SDK synchronously. Requires internet permissions. ### Method POST ### Endpoint MobileAds.initialize(context: Context, initializationConfig: InitializationConfig, listener: OnAdapterInitializationCompleteListener?) ### Parameters #### Request Body - **context** (Context) - Required - The application context. - **initializationConfig** (InitializationConfig) - Required - Configuration settings for initialization. - **listener** (OnAdapterInitializationCompleteListener) - Optional - Callback listener for initialization completion. ### Request Example { "context": "ApplicationContext", "initializationConfig": "ConfigObject" } ### Response #### Success Response (200) - **status** (Unit) - Returns void upon successful initiation call. ``` -------------------------------- ### Create NativeSignalRequest Builder with Signal Type (Kotlin) Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/nativead/NativeSignalRequest Gets a Builder for NativeSignalRequest, requiring a signal type string. This constructor is used to start the process of building a NativeSignalRequest with a specified signal type. ```kotlin Builder(signalType: String) ``` -------------------------------- ### Get Scroll Bar Default Delay Before Fade - Java Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/banner/AdView?hl=ar Returns the default delay in milliseconds before the scroll bar starts to fade out after user interaction stops. This controls the visibility duration of the scroll bar. ```Java int getScrollBarDefaultDelayBeforeFade() { // Implementation details... } ``` -------------------------------- ### InitializationConfig Builder Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=id Explains the builder pattern for `InitializationConfig` in the GMA Next-Gen SDK, which is not present in the old SDK. ```APIDOC ## InitializationConfig Builder ### Description Provides a builder for creating an `InitializationConfig` object, allowing for the configuration of SDK initialization parameters. ### Method `InitializationConfig.Builder() ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Getting Child Drawing Order in Android Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=hi Determines the order in which child views are drawn. This method can be overridden to implement custom drawing orders, for example, to bring certain views to the front. It takes the child count and index as parameters. ```java int getChildDrawingOrder(int p0, int p1) ``` -------------------------------- ### Getting Layout Mode in Android Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=hi Returns the current layout mode of the ViewGroup. This mode dictates how the ViewGroup arranges its children, for example, whether it uses traditional layout parameters or more modern constraints. The return value is an integer representing the mode. ```java int getLayoutMode() ``` -------------------------------- ### Pass Ad Source Adapter Parameters - Java Source: https://developers.google.com/admob/android/next-gen/migration/migrate-ad-requests This Java code example demonstrates passing extra parameters to a sample ad source adapter with the GMA Next-Gen SDK. Consult the relevant ad source integration guide for specific adapter instructions. ```java Bundle extras = new Bundle(); extras.putString("exampleKey", "exampleValue"); AdRequest request = new AdRequest.Builder("AD_UNIT_ID") .putAdSourceExtrasBundle(SampleAdapter.class, extras) .build(); ``` -------------------------------- ### InitializationConfig Class Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/initialization/package-summary?hl=id Configures the initialization process of the SDK and session-level settings. ```APIDOC ## Class InitializationConfig ### Description Class for configuring the initialization process of the SDK and some session-level settings. ### Method N/A (Class) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### InitializationConfig Class Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/initialization/package-summary?hl=pt-br Configures the initialization process of the SDK and session-level settings. ```APIDOC ## Class InitializationConfig ### Description Class for configuring the initialization process of the SDK and some session-level settings. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (N/A) - **Builder** (InitializationConfig.Builder) - A builder for constructing an `InitializationConfig`. #### Response Example N/A ``` -------------------------------- ### Android View Padding and Scrollbar Properties Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/banner/AdView?hl=he Methods for retrieving padding values and scrollbar configuration for Android Views. This includes getting bottom, end, left, right, start, and top padding. Scrollbar properties like default delay, fade duration, and size are also accessible. ```java int getPaddingBottom() { // Implementation details... return 0; // Example value } int getPaddingEnd() { // Implementation details... return 0; // Example value } int getPaddingLeft() { // Implementation details... return 0; // Example value } int getPaddingRight() { // Implementation details... return 0; // Example value } int getPaddingStart() { // Implementation details... return 0; // Example value } int getPaddingTop() { // Implementation details... return 0; // Example value } int getScrollBarDefaultDelayBeforeFade() { // Implementation details... return 0; // Example value } int getScrollBarFadeDuration() { // Implementation details... return 0; // Example value } int getScrollBarSize() { // Implementation details... return 0; // Example value } ``` -------------------------------- ### InitializationConfig Builder Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=vi Explains the builder pattern for creating `InitializationConfig` objects in the GMA Next-Gen SDK, which was not present in the old SDK. ```APIDOC ## InitializationConfig Builder ### Description Provides a builder for constructing `InitializationConfig` objects, used in the `MobileAds.initialize` method of the GMA Next-Gen SDK. ### Method `InitializationConfig.Builder() ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example **GMA Next-Gen SDK:** `InitializationConfig.Builder(String applicationId)` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Set Network-Specific Ad Request Parameters Source: https://developers.google.com/admob/android/next-gen/mediation/liftoff-monetize Demonstrates how to pass custom parameters such as userId, ad orientation, and back button configuration to the Liftoff Monetize adapter using a Bundle and AdRequest.Builder. ```Java Bundle extras = new Bundle(); extras.putString(VungleConstants.KEY_USER_ID, "myUserID"); extras.putInt(VungleConstants.KEY_ORIENTATION, 1); // Optional: Enables the back button on App Open ads immediately. extras.putBoolean(VungleConstants.KEY_BACK_BUTTON_IMMEDIATELY_ENABLED, true); AdRequest request = new AdRequest.Builder() .addNetworkExtrasBundle(VungleAdapter.class, extras) // Rewarded. .addNetworkExtrasBundle(VungleInterstitialAdapter.class, extras) // Interstitial. // App Open ads use VungleMediationAdapter .addNetworkExtrasBundle(VungleMediationAdapter.class, extras) .build(); ``` ```Kotlin val extras = Bundle() extras.putString(VungleConstants.KEY_USER_ID, "myUserID") extras.putInt(VungleConstants.KEY_ORIENTATION, 1) // Optional: Enables the back button on App Open ads immediately. extras.putBoolean(VungleConstants.KEY_BACK_BUTTON_IMMEDIATELY_ENABLED, true) val request = AdRequest.Builder() .addNetworkExtrasBundle(VungleAdapter::class.java, extras) // Rewarded. .addNetworkExtrasBundle(VungleInterstitialAdapter::class.java, extras) // Interstitial. // App Open ads use VungleMediationAdapter .addNetworkExtrasBundle(VungleMediationAdapter::class.java, extras) .build() ``` -------------------------------- ### Context Menu and Actions Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/BaseAdAssetViewContainer?hl=bn Methods for showing context menus and starting actions like ActionMode. ```APIDOC ## CONTEXT MENU AND ACTIONS ### Description Methods to display context menus and initiate ActionMode. ### Method Various (boolean, ActionMode) ### Endpoint N/A (Instance Methods) ### Parameters - **showContextMenu** () - Shows the context menu for the view. - **showContextMenu** (float x, float y) - Shows the context menu at the specified coordinates. - **startActionMode** (ActionMode.Callback callback) - Starts an ActionMode with the given callback. - **startActionMode** (ActionMode.Callback callback, int type) - Starts an ActionMode with the given callback and type. ### Request Example N/A ### Response #### Success Response (boolean or ActionMode) N/A #### Response Example N/A ``` -------------------------------- ### Get View State and Context Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/MediaView?hl=fr Retrieves the current state and context of an Android View. This includes getting the drawable state, the view's context, and its unique ID. Also provides methods for getting the application window token. ```java final @NonNull int[] getDrawableState(); final @NonNull Context getContext(); @NonNull IBinder getApplicationWindowToken(); @NonNull ContextMenu.ContextMenuInfo getContextMenuInfo(); @NonNull Handler getHandler(); @NonNull Display getDisplay(); @NonNull ArrayList<@NonNull View> getFocusables(int p0); @NonNull Rect getHitRect(@NonNull Rect p0); @NonNull Drawable getBackground(); @NonNull Drawable getForeground(); @NonNull Matrix getAnimationMatrix(); @NonNull Animation getAnimation(); @NonNull Rect getClipBounds(); @NonNull Bitmap getDrawingCache(); @NonNull Bitmap getDrawingCache(boolean p0); ``` -------------------------------- ### InitializationStatus Interface Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/initialization/package-summary?hl=es Defines the status of the SDK initialization. ```APIDOC ## Interface InitializationStatus ### Description The status of the SDK initialization. ### Method N/A (Interface) ### Endpoint N/A (Interface) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### MobileAds Initialization Source: https://developers.google.com/admob/android/next-gen/migration/migrate-with-ai-tools?hl=vi This section details the initialization process for the MobileAds SDK, highlighting the differences in method signatures between the old and GMA Next-Gen SDKs. ```APIDOC ## MobileAds Initialization ### Description Initializes the MobileAds SDK. The Next-Gen SDK introduces an `InitializationConfig` for more granular control. ### Method `MobileAds.initialize() ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example **Old SDK:** `MobileAds.initialize(Context context, OnInitializationCompleteListener listener)` **GMA Next-Gen SDK:** `MobileAds.initialize(Context context, InitializationConfig config, OnInitializationCompleteListener listener)` ### Response #### Success Response (200) N/A (Initialization is typically asynchronous) #### Response Example N/A ``` -------------------------------- ### Notify Rewarded Ad Video Start Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/gms/ads/mediation/MediationRewardedAdCallback Notifies the Google Mobile Ads SDK that a rewarded ad video has started playing. ```kotlin fun onVideoStart(): Unit ``` ```java void onVideoStart(); ``` -------------------------------- ### Configure Ad Request Parameters Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/banner/BannerSignalRequest.Builder Shows how to chain configuration methods to set targeting keywords, custom parameters, and ad unit IDs before building the request. ```kotlin val request = BannerSignalRequest.Builder("banner") .setAdUnitId("ca-app-pub-0000000000000000/0000000000") .addKeyword("gaming") .putCustomTargeting("gender", "male") .build() ``` -------------------------------- ### Start ad preloading Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/rewarded/RewardedAdPreloader.Companion Initiates the preloading process for rewarded ads. Supports starting with or without a callback. ```java public static boolean start(@NonNull String preloadId, @NonNull PreloadConfiguration preloadConfiguration); public static boolean start(@NonNull String preloadId, @NonNull PreloadConfiguration preloadConfiguration, PreloadCallback preloadCallback); ``` -------------------------------- ### start (no callback) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/AdPreloader?hl=tr Starts preloading ads for a given preload ID and configuration without a callback. ```APIDOC ## POST /start ### Description Starts preloading without a callback. ### Method POST ### Endpoint `/start` ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **preloadId** (String) - Required - The ID for the preload operation. - **preloadConfiguration** (Object) - Required - The configuration for preloading ads. ``` -------------------------------- ### Initialize GMA Next-Gen SDK Source: https://developers.google.com/admob/android/next-gen/quick-start Demonstrates how to initialize the GMA Next-Gen SDK using a background thread to ensure app responsiveness. Includes the use of InitializationConfig to set the app ID and a completion listener for adapter status. ```kotlin import com.google.android.libraries.ads.mobile.sdk.MobileAds import com.google.android.libraries.ads.mobile.sdk.initialization.InitializationConfig import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val backgroundScope = CoroutineScope(Dispatchers.IO) backgroundScope.launch { MobileAds.initialize( this@MainActivity, InitializationConfig.Builder("SAMPLE_APP_ID").build() ) { // Adapter initialization is complete. } } } } ``` ```java import com.google.android.libraries.ads.mobile.sdk.MobileAds; import com.google.android.libraries.ads.mobile.sdk.initialization.InitializationConfig; public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new Thread( () -> { MobileAds.initialize( this, new InitializationConfig.Builder("SAMPLE_APP_ID") .build(), initializationStatus -> { // Adapter initialization is complete. }); }) .start(); } } ``` -------------------------------- ### UserMessagingPlatform SDK Entry Point Source: https://developers.google.com/admob/android/next-gen/reference/privacy/com/google/android/ump/package-summary?hl=fr The `UserMessagingPlatform` class is the main entry point for the User Messaging Platform SDK. It provides methods for loading and displaying consent forms. ```APIDOC ## Class: UserMessagingPlatform ### Description Entry point for the User Messaging Platform SDK. ### Methods - `loadConsentForm(Context context, UserMessagingPlatform.OnConsentFormLoadSuccessListener listener, UserMessagingPlatform.OnConsentFormLoadFailureListener failureListener)`: Loads a consent form. - `showConsentForm(Activity activity, ConsentForm.OnConsentFormDismissedListener listener)`: Shows a loaded consent form. ### Listeners - `UserMessagingPlatform.OnConsentFormLoadSuccessListener` - `UserMessagingPlatform.OnConsentFormLoadFailureListener` ``` -------------------------------- ### getInitializationStatus Source: https://developers.google.com/admob/android/next-gen/reference/kotlin/com/google/android/libraries/ads/mobile/sdk/MobileAds?hl=pt-br Gets the SDK initialization status. ```APIDOC ## GET /getInitializationStatus ### Description Gets the SDK initialization status. ### Method GET ### Endpoint /getInitializationStatus ### Response #### Success Response (200) - **InitializationStatus** (InitializationStatus) - The current initialization status of the SDK. #### Response Example ```json { "status": "INITIALIZED" } ``` ``` -------------------------------- ### Get Camera Distance in Android Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=th Gets the distance of the view from the camera. This affects the perspective and scaling in 3D transformations. ```java float getCameraDistance() ``` -------------------------------- ### Initialize ConsentInformation Instance Source: https://developers.google.com/admob/android/next-gen/privacy Declare and initialize the ConsentInformation instance required to manage user consent status. ```java private final ConsentInformation consentInformation; consentInformation = UserMessagingPlatform.getConsentInformation(context); ``` ```kotlin private lateinit var consentInformation: ConsentInformation consentInformation = UserMessagingPlatform.getConsentInformation(context) ``` -------------------------------- ### Get Animation Matrix in Android Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=th Gets the animation matrix applied to the view. This matrix transforms the view during animation. ```java @Nullable Matrix getAnimationMatrix() ``` -------------------------------- ### AppOpenAdPreloader Class Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/appopen/package-summary?hl=zh-cn Handles preloading of AppOpenAds. ```APIDOC ## Class AppOpenAdPreloader ### Description Handles preloading of AppOpenAds. ### Method N/A (Class) ### Endpoint N/A (Class) ### Parameters N/A ### Request Example N/A ### Response N/A ### Related Classes - `AppOpenAdPreloader.Companion` ``` -------------------------------- ### Get View Position and Bounds - Android View Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/nativead/NativeAdView?hl=pl Provides methods to get the position and boundaries of a view. These include the left and right coordinates, as well as the ability to get the view's rectangle in local coordinates. Useful for touch event handling and layout calculations. ```java final int getLeft() {} final int getRight() {} final boolean getLocalVisibleRect(@NonNull Rect p0) ``` -------------------------------- ### Start and Update Animations (Java) Source: https://developers.google.com/admob/android/next-gen/reference/com/google/android/libraries/ads/mobile/sdk/common/BaseAdAssetViewContainer Methods to start an animation on a View and update its drag shadow during a drag-and-drop operation. ```java void startAnimation(@NonNull Animation p0) final void updateDragShadow(@NonNull View.DragShadowBuilder p0) ```