This ad is used to load and display on the splash screen of an Android application. A splash ad is a full-screen advertisement that appears when the user opens the app, before the main interface is fully loaded.

Load Ad

This function loads a splash screen advertisement within the specified Android activity. The ad is initialized asynchronously, and the provided IKLoadAdListener is used to handle callbacks related to the ad loading process.

Reference

  com.ikame.android.sdk.IKSdkController#loadSplashScreenAd
  

Function Definition

  fun loadSplashScreenAd(activity: Activity?, listener: IKLoadAdListener?)
  

Parameters:

  • activity: The Activity in which the splash ad will be displayed. This can be null if no specific activity context is required at the time of calling.
  • listener: An implementation of the IKLoadAdListener interface, which will receive notifications about the ad’s load status, including success and failure events.

Sample:

Show Ad

Use the LoadAd and ShowAd functions when you want to preload an ad in a specific state. First, you need to call LoadAd to initiate the ad loading process. Once the ad is fully loaded and you’re ready to display it, call the ShowAd function.

It is important to load the ad beforehand, as ShowAd will run in the background. When you invoke ShowAd, it will automatically wait for the ad to load successfully before displaying it. This ensures a seamless ad experience for the user.

This suspend function displays a splash screen advertisement in the specified activity. It utilizes Kotlin coroutines, allowing the function to be suspended until the ad is either successfully shown or fails. The provided IKShowAdListener is used to receive callbacks about the ad display status.

Reference

  com.ikame.android.sdk.IKSdkController#showSplashScreenAd
  

Function Definition

  fun showSplashScreenAd(
        activity: Activity?, listener: IKShowAdListener?
)
  

Parameters:

  • activity: The Activity where the splash ad will be displayed. This can be null if no specific activity context is needed at the time of showing the ad.
  • listener: An implementation of the IKShowAdListener interface to handle events related to the ad’s display, such as success, failure, or dismissal. Return: Returns a Job? that represents the coroutine handling the ad display process. It can be used to manage the coroutine’s lifecycle or cancel it if needed.

Sample:

Load And Show

This function asynchronously loads and displays a splash screen advertisement within the provided activity. It combines the processes of both loading and showing the ad, making it convenient for developers who want to handle the entire splash ad lifecycle in a single call. The provided IKShowAdListener is used to track the status of the ad display.

Set Timeout showAd

This is the method to set a timeout for showing ads. If not set, the timeout time will default to the SDK. When the timeout is enabled, if the ad doesn’t open within the specified time, it triggers a timeout event onAdsShowTimeout.

Ad Listener Interfaces

  • IKLoadAdListener Interface: Provides methods for general ad loading processes, encompassing notifications for both successful loads and failures.
  • IKShowAdListener: interface defines the callback methods that handle different states of ad display events within an application.