Class NativeAd

java.lang.Object
com.codename1.ads.NativeAd

public class NativeAd extends Object

The assets of a native ad, loaded by NativeAdLoader. A native ad lets you render the advertiser's content with your own components so it blends with the surrounding UI. Not every field is populated for every ad; check for null before use.

Native ad support is an optional provider capability. When the active provider does not support it, NativeAdLoader reports the format as unsupported.

  • Constructor Details

    • NativeAd

      public NativeAd(String headline, String body, String callToAction, String advertiser, String iconUrl, String imageUrl, double starRating)
      Creates a native ad asset bundle. Intended for providers; applications receive instances through NativeAdLoader.
  • Method Details

    • getHeadline

      public String getHeadline()
      The ad headline, may be null.
    • getBody

      public String getBody()
      The ad body text, may be null.
    • getCallToAction

      public String getCallToAction()
      The call to action label (e.g. "Install"), may be null.
    • getAdvertiser

      public String getAdvertiser()
      The advertiser name, may be null.
    • getIconUrl

      public String getIconUrl()
      The URL of the ad icon, may be null.
    • getImageUrl

      public String getImageUrl()
      The URL of the main ad image, may be null.
    • getStarRating

      public double getStarRating()
      The star rating (0-5), or 0 when not provided.