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:

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 AdCallbackSingle-method callback used throughout the advertising API for asynchronous results (initialization, consent, native ad loading).
class AdConfigConfiguration passed once to AdManager.initialize(AdConfig, AdCallback).
class AdConsentManages user privacy consent for advertising.
class AdErrorDescribes a failure delivered to AdListener.onFailedToLoad(AdError) or AdListener.onShowFailed(AdError).
enum AdFormatThe ad formats supported by the modern advertising API.
class AdListenerReceives the lifecycle events of an ad.
class AdManagerThe entry point of the Codename One advertising API.
class AdRequestOptional targeting metadata attached to an ad load.
class AdsServiceThis is an abstract Ads Service.
class AppOpenAdA full screen ad shown while the application is being brought to the foreground, overlaying the launch/splash experience.
class BannerAdA banner ad that lives inside the Codename One component hierarchy.
class InnerActiveThis is an Ad service implementation by InnerActive see: http://console.inner-active.com/iamp/publisher/register?ref_id=affiliate_CodenameOne
class InterstitialAdA full screen interstitial ad shown at natural break points such as between game levels or activities.
class NativeAdThe assets of a native ad, loaded by NativeAdLoader.
class NativeAdLoaderLoads NativeAd assets that you render with your own components, so the ad matches the look and feel of the surrounding content.
interface OnUserEarnedRewardListenerInvoked when the user finished watching a RewardedAd or RewardedInterstitialAd and earned the configured reward.
class RewardItemThe reward earned by a user who finished watching a RewardedAd or RewardedInterstitialAd.
class RewardedAdAn opt-in full screen ad that grants the user a reward for watching it to completion.
class RewardedInterstitialAdA rewarded interstitial: a full screen ad shown at a transition that can grant a reward but, unlike RewardedAd, is not strictly opt-in.
class ServerSideVerificationOptionsOptions for server side verification (SSV) of rewarded ads.