Class LocationRequest

java.lang.Object
com.codename1.location.LocationRequest

public class LocationRequest extends Object
This class is used when requesting to listen to location update. See l, com.codename1.location.LocationRequest req) setLocationListener
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    When you need gps location updates
    static final int
    When accuracy is not important and you want to save battery
    static final int
    When accuracy is not highly important and you want to save battery
  • Constructor Summary

    Constructors
    Constructor
    Description
    Empty Constructor
    LocationRequest(int priority, long interval)
    Simple Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Gest the request time interval
    int
    Gets the request priority

    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.
  • Field Details

    • PRIORITY_HIGH_ACCUARCY

      public static final int PRIORITY_HIGH_ACCUARCY
      When you need gps location updates
      See Also:
    • PRIORITY_MEDIUM_ACCUARCY

      public static final int PRIORITY_MEDIUM_ACCUARCY
      When accuracy is not highly important and you want to save battery
      See Also:
    • PRIORITY_LOW_ACCUARCY

      public static final int PRIORITY_LOW_ACCUARCY
      When accuracy is not important and you want to save battery
      See Also:
  • Constructor Details

    • LocationRequest

      public LocationRequest()
      Empty Constructor
    • LocationRequest

      public LocationRequest(int priority, long interval)

      Simple Constructor

      Parameters
      • priority: @param priority The priority we are interested to listen for location updates. PRIORITY_HIGH_ACCUARCY, PRIORITY_MEDIUM_ACCUARCY, PRIORITY_LOW_ACCUARCY High priority means gps locations which is CPU intensive and consumes more battery. Medium priority is less intensive in terms of battery and might return a gps or a network location which is less accurate. Low priority won't consume the battery and will return a gps location if available otherwise the location would be a network location.

      • interval: @param interval time in milliseconds which determines what are the time intervals that we would like to get updates from the OS. This is a request only and might not be respected by the underlying OS

  • Method Details

    • getPriority

      public int getPriority()
      Gets the request priority
    • getInterval

      public long getInterval()
      Gest the request time interval