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.
Types
interface AdCallback | Single-method callback used throughout the advertising API for asynchronous results (initialization, consent, native ad loading). |
class AdConfig | Configuration passed once to AdManager.initialize(AdConfig, AdCallback). |
class AdConsent | Manages user privacy consent for advertising. |
class AdError | Describes a failure delivered to AdListener.onFailedToLoad(AdError) or AdListener.onShowFailed(AdError). |
enum AdFormat | The ad formats supported by the modern advertising API. |
class AdListener | Receives the lifecycle events of an ad. |
class AdManager | The entry point of the Codename One advertising API. |
class AdRequest | Optional targeting metadata attached to an ad load. |
class AdsService | This is an abstract Ads Service. |
class AppOpenAd | A full screen ad shown while the application is being brought to the foreground, overlaying the launch/splash experience. |
class BannerAd | A banner ad that lives inside the Codename One component hierarchy. |
class InnerActive | This is an Ad service implementation by InnerActive see: http://console.inner-active.com/iamp/publisher/register?ref_id=affiliate_CodenameOne |
class InterstitialAd | A full screen interstitial ad shown at natural break points such as between game levels or activities. |
class NativeAd | The assets of a native ad, loaded by NativeAdLoader. |
class NativeAdLoader | Loads NativeAd assets that you render with your own components, so the ad matches the look and feel of the surrounding content. |
interface OnUserEarnedRewardListener | Invoked when the user finished watching a RewardedAd or RewardedInterstitialAd and earned the configured reward. |
class RewardItem | The reward earned by a user who finished watching a RewardedAd or RewardedInterstitialAd. |
class RewardedAd | An opt-in full screen ad that grants the user a reward for watching it to completion. |
class RewardedInterstitialAd | A rewarded interstitial: a full screen ad shown at a transition that can grant a reward but, unlike RewardedAd, is not strictly opt-in. |
class ServerSideVerificationOptions | Options for server side verification (SSV) of rewarded ads. |