create Banner Tablet
Creates an ad object using the provided ad unit ID. Optionally, a watermark string can be added to the ad. The result of the ad creation process is returned through the provided callback, which will either contain the created ad object or an error describing the failure. NOTE - The API requires Moloco.initialize to have been called. Tablet banner container size should be 728x90
Parameters
The unique identifier for the ad unit to load the ad from. This must be a valid ad unit ID
An optional string that, if provided, will be displayed as a watermark on the ad. If null, no watermark will be applied.
A callback function that will be invoked when the ad creation process is complete. It returns either a valid ad object (e.g., Banner, Interstitial, Rewarded, Native) if successful, or a AdCreateError indicating the type of error that occurred.
Samples
import android.content.Context
import android.widget.FrameLayout
import com.moloco.sdk.internal.MolocoLogger
import com.moloco.sdk.publisher.MolocoAdError.AdCreateError
import com.moloco.sdk.publisher.init.MolocoInitParams
fun main() {
//sampleStart
/**
* createXXX calls requires [Moloco.initialize] to have been invoked
*/
Moloco.createBannerTablet("MOLOCO_ADUNIT_ID") { banner: Banner?, adCreateError: AdCreateError? ->
if (banner != null) {
banner.load("bid_response", listener = null)
frameLayout.addView(banner)
// ...
banner.destroy()
frameLayout.removeView(banner)
} else {
// Use the `adCreateError` to determine the error
}
}
//sampleEnd
}