public class LocationRequest

  1. Object
  2. LocationRequest
This class is used when requesting to listen to location update. See l, com.codename1.location.LocationRequest req) setLocationListener

Fields

public static final int PRIORITY_HIGH_ACCUARCY = 0When you need gps location updates
public static final int PRIORITY_MEDIUM_ACCUARCY = 1When accuracy is not highly important and you want to save battery
public static final int PRIORITY_LOW_ACCUARCY = 2When accuracy is not important and you want to save battery

Constructors

public LocationRequest()Empty Constructor
public LocationRequest(int priority, long interval)Simple Constructor

Methods

public int getPriority()Gets the request priority
public long getInterval()Gest the request time interval

Inherited methods

Field details

PRIORITY_HIGH_ACCUARCY

public static final int PRIORITY_HIGH_ACCUARCY = 0
When you need gps location updates

PRIORITY_MEDIUM_ACCUARCY

public static final int PRIORITY_MEDIUM_ACCUARCY = 1
When accuracy is not highly important and you want to save battery

PRIORITY_LOW_ACCUARCY

public static final int PRIORITY_LOW_ACCUARCY = 2
When accuracy is not important and you want to save battery

Constructor details

LocationRequest

public LocationRequest()
Empty Constructor

LocationRequest

public LocationRequest(int priority, long interval)
Simple Constructor

Parameters

priority int
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 long
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