Class FullScreenAdService

java.lang.Object
com.codename1.impl.FullScreenAdService
Direct Known Subclasses:
VServAds

public abstract class FullScreenAdService extends Object
Abstract class for fullscreen ads that appear before and possibly after application execution as well as randomly between application screen transitions.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bindTransitionAd(int timeForNext)
    Binds an ad to appear periodically after a given timeout
    protected abstract void
    Removes the pending ad data so we can fetch a new ad
    protected abstract ConnectionRequest
    Creates a new request for an ad
    protected abstract boolean
    Returns true if the connection failed
    protected abstract String
    Returns the URL for the ad
    int
    Returns
    protected abstract Component
    Component representing a given ad
    int
    The timeout in milliseconds for an ad request
    protected abstract boolean
    Just checks if an ad is already fetched
    boolean
    Returns
    boolean
    If set to true this flag allows the application to load even if an Ad cannot be displayed
    boolean
    Returns
    void
    setAdDisplayTime(int adDisplayTime)
    Parameters
    void
    setAllowSkipping(boolean allowSkipping)
    Parameters
    void
    setAllowWithoutNetwork(boolean allowWithoutNetwork)
    If set to true this flag allows the application to load even if an Ad cannot be displayed
    void
    setScaleMode(boolean scaleMode)
    Parameters
    void
    setTimeout(int timeout)
    The timeout in milliseconds for an ad request
    void
    Invoked on application startup, this code will download an ad or timeout

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • Constructor Details

    • FullScreenAdService

      public FullScreenAdService()
  • Method Details

    • createAdRequest

      protected abstract ConnectionRequest createAdRequest()

      Creates a new request for an ad

      Returns

      the network operation

    • getPendingAd

      protected abstract Component getPendingAd()

      Component representing a given ad

      Returns

      the ad that is currently pending

    • hasPendingAd

      protected abstract boolean hasPendingAd()

      Just checks if an ad is already fetched

      Returns

      returns true if an ad is already waiting in the queue

    • clearPendingAd

      protected abstract void clearPendingAd()
      Removes the pending ad data so we can fetch a new ad
    • getAdDestination

      protected abstract String getAdDestination()

      Returns the URL for the ad

      Returns

      the ad URL

    • failed

      protected abstract boolean failed()
      Returns true if the connection failed
    • showWelcomeAd

      public void showWelcomeAd()
      Invoked on application startup, this code will download an ad or timeout
    • bindTransitionAd

      public void bindTransitionAd(int timeForNext)

      Binds an ad to appear periodically after a given timeout

      Parameters
      • timeForNext: the timeout in which an ad should be shown in milliseconds
    • isAllowWithoutNetwork

      public boolean isAllowWithoutNetwork()

      If set to true this flag allows the application to load even if an Ad cannot be displayed

      Returns

      the allowWithoutNetwork

    • setAllowWithoutNetwork

      public void setAllowWithoutNetwork(boolean allowWithoutNetwork)

      If set to true this flag allows the application to load even if an Ad cannot be displayed

      Parameters
      • allowWithoutNetwork: the allowWithoutNetwork to set
    • getTimeout

      public int getTimeout()

      The timeout in milliseconds for an ad request

      Returns

      the timeout

    • setTimeout

      public void setTimeout(int timeout)

      The timeout in milliseconds for an ad request

      Parameters
      • timeout: the timeout to set
    • getAdDisplayTime

      public int getAdDisplayTime()
      Returns

      the adDisplayTime

    • setAdDisplayTime

      public void setAdDisplayTime(int adDisplayTime)
      Parameters
      • adDisplayTime: the adDisplayTime to set
    • isScaleMode

      public boolean isScaleMode()
      Returns

      the scaleMode

    • setScaleMode

      public void setScaleMode(boolean scaleMode)
      Parameters
      • scaleMode: the scaleMode to set
    • isAllowSkipping

      public boolean isAllowSkipping()
      Returns

      the allowSkipping

    • setAllowSkipping

      public void setAllowSkipping(boolean allowSkipping)
      Parameters
      • allowSkipping: the allowSkipping to set