Interface AdProvider
The service provider interface implemented by an ad network library (such
as the Google AdMob library). A provider is the seam that lets the
com.codename1.ads API stay network agnostic: AdMob, AppLovin MAX, Unity
LevelPlay or a custom mediation layer can each be plugged in by implementing
this interface and registering with
AdManager.registerProvider(AdProvider).
A library typically exposes a static install() method that constructs and
registers its provider, so applications enable it with a single line.
Applications never reference this type directly; they use
AdManager and the format classes.
-
Method Summary
Modifier and TypeMethodDescriptioncreateBanner(String adUnitId, int bannerSize, int widthDp) Creates a banner session of the requested size.createFullScreenAd(AdFormat format, String adUnitId) Creates a session for a full screen ad of the given format.The consent controller for this provider.getName()A short human readable provider name, e.g.voidinitialize(AdConfig config, AdCallback<Boolean> onComplete) Initializes the underlying SDK.booleanisFormatSupported(AdFormat format) True when this provider supports the given ad format.booleanTrue when this provider can run on the current platform.
-
Method Details
-
getName
String getName()A short human readable provider name, e.g. "AdMob". -
isSupported
boolean isSupported()True when this provider can run on the current platform. -
isFormatSupported
True when this provider supports the given ad format. -
initialize
Initializes the underlying SDK. Must invoke the callback (with
Boolean.TRUEon success) when initialization completes. Implementations should be idempotent.Parameters
config: the global ad configurationonComplete: invoked when initialization finishes
-
createFullScreenAd
Creates a session for a full screen ad of the given format. Returns null if the format is unsupported.
Parameters
format: one of the full screen formatsadUnitId: the ad unit identifier from the network console
-
createBanner
Creates a banner session of the requested size. Returns null if banners are unsupported.
Parameters
adUnitId: the ad unit identifier from the network consolebannerSize: one of the size constants inBannerAdwidthDp: requested width in display-independent pixels for adaptive banners, or 0 to use the available width
-
getConsentController
AdConsentController getConsentController()The consent controller for this provider. Returns null if the provider has no consent management of its own.
-