Package com.codename1.ads
The modern, pluggable Codename One advertising API.
Start from AdManager, which selects an ad network
provider (supplied by an ad cn1lib such as the Google AdMob library) and
exposes the full set of contemporary ad formats:
BannerAd- an inline/adaptive banner componentInterstitialAd- full screen ads at natural breaksRewardedAd- opt-in ads that grant a rewardRewardedInterstitialAd- incentivized transition adsAppOpenAd- ads shown when the app is foregroundedNativeAd- assets rendered with your own components
Privacy consent (GDPR via the User Messaging Platform, and iOS App Tracking
Transparency) is handled by AdConsent. Ad networks plug
in by implementing AdProvider; the design stays
network agnostic so AdMob, AppLovin MAX, Unity LevelPlay or a custom
mediation layer can be swapped without touching application code.
Legacy API
The original banner ad service in this package - AdsService
and InnerActive, along with com.codename1.components.Ads
and com.codename1.impl.FullScreenAdService - is deprecated. It targets ad
networks that no longer exist and predates consent management. Use
AdManager for all new development.
-
ClassDescriptionAdCallback<T>Single-method callback used throughout the advertising API for asynchronous results (initialization, consent, native ad loading).Configuration passed once to
AdManager.initialize(AdConfig, AdCallback).Manages user privacy consent for advertising.Describes a failure delivered toAdListener.onFailedToLoad(AdError)orAdListener.onShowFailed(AdError).The ad formats supported by the modern advertising API.Receives the lifecycle events of an ad.The entry point of the Codename One advertising API.Optional targeting metadata attached to an ad load.Deprecated.this legacy banner ad service targets ad networks that no longer exist and predates consent management.A full screen ad shown while the application is being brought to the foreground, overlaying the launch/splash experience.A banner ad that lives inside the Codename One component hierarchy.Deprecated.the InnerActive ad network is defunct.A full screen interstitial ad shown at natural break points such as between game levels or activities.The assets of a native ad, loaded byNativeAdLoader.LoadsNativeAdassets that you render with your own components, so the ad matches the look and feel of the surrounding content.Invoked when the user finished watching aRewardedAdorRewardedInterstitialAdand earned the configured reward.An opt-in full screen ad that grants the user a reward for watching it to completion.A rewarded interstitial: a full screen ad shown at a transition that can grant a reward but, unlikeRewardedAd, is not strictly opt-in.The reward earned by a user who finished watching aRewardedAdorRewardedInterstitialAd.Options for server side verification (SSV) of rewarded ads.