Class NativeAd

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

public class NativeAd extends java.lang.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 Summary

    Constructors
    Constructor
    Description
    NativeAd(String headline, String body, String callToAction, String advertiser, String iconUrl, String imageUrl, double starRating)
    Creates a native ad asset bundle.
  • Method Summary

    Modifier and Type
    Method
    Description
    The advertiser name, may be null.
    The ad body text, may be null.
    The call to action label (e.g. "Install"), may be null.
    The ad headline, may be null.
    The URL of the ad icon, may be null.
    The URL of the main ad image, may be null.
    double
    The star rating (0-5), or 0 when not provided.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.