# Package com.codename1.ads

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 component
- `InterstitialAd` - full screen ads at natural breaks
- `RewardedAd` - opt-in ads that grant a reward
- `RewardedInterstitialAd` - incentivized transition ads
- `AppOpenAd` - ads shown when the app is foregrounded
- `NativeAd` - 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.

- Related Packages
  Package
  Description
  com.codename1.ads.spi
  Service provider interface (SPI) for the Codename One advertising API.
- Class
  Description
  AdCallback<T>
  Single-method callback used throughout the advertising API for asynchronous results (initialization, consent, native ad loading).
  AdConfig
  Configuration passed once to `AdManager.initialize(AdConfig, AdCallback)`.
  AdConsent
  Manages user privacy consent for advertising.
  AdError
  Describes a failure delivered to `AdListener.onFailedToLoad(AdError)` or `AdListener.onShowFailed(AdError)`.
  AdFormat
  The ad formats supported by the modern advertising API.
  AdListener
  Receives the lifecycle events of an ad.
  AdManager
  The entry point of the Codename One advertising API.
  AdRequest
  Optional targeting metadata attached to an ad load.
  AdsService
  Deprecated.
  this legacy banner ad service targets ad networks that no longer exist and predates consent management.
  AppOpenAd
  A full screen ad shown while the application is being brought to the foreground, overlaying the launch/splash experience.
  BannerAd
  A banner ad that lives inside the Codename One component hierarchy.
  InnerActive
  Deprecated.
  the InnerActive ad network is defunct.
  InterstitialAd
  A full screen interstitial ad shown at natural break points such as between game levels or activities.
  NativeAd
  The assets of a native ad, loaded by `NativeAdLoader`.
  NativeAdLoader
  Loads `NativeAd` assets that you render with your own components, so the ad matches the look and feel of the surrounding content.
  OnUserEarnedRewardListener
  Invoked when the user finished watching a `RewardedAd` or `RewardedInterstitialAd` and earned the configured reward.
  RewardedAd
  An opt-in full screen ad that grants the user a reward for watching it to completion.
  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.
  RewardItem
  The reward earned by a user who finished watching a `RewardedAd` or `RewardedInterstitialAd`.
  ServerSideVerificationOptions
  Options for server side verification (SSV) of rewarded ads.