Class LocationRequest

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

public class LocationRequest extends java.lang.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 java.lang.Object

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