com.esri.android.map
Class LocationService

java.lang.Object
  extended by com.esri.android.map.LocationService

public class LocationService
extends Object

Class providing UI support to display the current location of the device on a MapView. To get an instance of a LocationService see MapView.getLocationService().


Method Summary
 android.location.Location getLocation()
          Returns the current location in the spatial reference WGS1984 (WKID=4326).
 android.location.LocationListener getLocationListener()
          Gets the Android LocationListener instance.
 int getMaxAccuracyCircleSize()
          Gets the max accuracy circle size in meter.
 Point getPoint()
          Returns the current coordinates in the map's spatial reference.
 Symbol getSymbol()
           
 boolean isAccuracyCircleOn()
          Checks if the accuracy circle is on.
 boolean isAllowNetworkLocation()
          Checks if the network provider is allowed to determine the current location.
 boolean isAutoPan()
           
 boolean isBearingOn()
           
 boolean isStarted()
           
 boolean isSymbolFound(float x, float y, int tolerance)
          Checks if location symbol is found for the given coordinates and tolerance.
 void setAccuracyCircleOn(boolean accuracyCircleOn)
          Enables/Disables the accuracy circle.
 void setAllowNetworkLocation(boolean allowNetworkLocation)
          Allow/disallow the usage of the network (cellular network and WiFi if available) to determine the current location
 void setAutoPan(boolean autoPan)
          activate/deactivate the autoPan
 void setBearing(boolean bearing)
          activate/deactivate the bearing representation.
 void setLocationListener(android.location.LocationListener locationListener)
          Sets the Android LocationListener instance.
 void setMaxAccuracyCircleSize(int maxSize)
          Sets the max accuracy circle size in meter.
 void setSymbol(Symbol symbol)
          Sets the symbol for location display.
 void start()
          Starts the LocationService.
 void stop()
          Stops the LocationService
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

start

public void start()
Starts the LocationService.


stop

public void stop()
Stops the LocationService


getLocation

public android.location.Location getLocation()
Returns the current location in the spatial reference WGS1984 (WKID=4326). Other information are available. see Location.

Returns:
the current location

getPoint

public Point getPoint()
Returns the current coordinates in the map's spatial reference.

Returns:
the Point containing the coordinates.

getSymbol

public Symbol getSymbol()
Returns:
the symbol used to represent the current location.

isBearingOn

public boolean isBearingOn()
Returns:
whether the bearing (direction of travel) is taken into account.

isStarted

public boolean isStarted()
Returns:
if the LocationService is activated.

isAutoPan

public boolean isAutoPan()
Returns:
whether the autoPan is activated or not.

getLocationListener

public android.location.LocationListener getLocationListener()
Gets the Android LocationListener instance.

Returns:
the locationListener

setLocationListener

public void setLocationListener(android.location.LocationListener locationListener)
Sets the Android LocationListener instance.

Parameters:
locationListener - the locationListener to set

setAutoPan

public void setAutoPan(boolean autoPan)
activate/deactivate the autoPan

Parameters:
autoPan - the flag for the autoPan (default: true)

setBearing

public void setBearing(boolean bearing)
activate/deactivate the bearing representation.

Parameters:
bearing - flag for the bearing (default: true)

setSymbol

public void setSymbol(Symbol symbol)
Sets the symbol for location display.

Parameters:
symbol - the symbol to set

isSymbolFound

public boolean isSymbolFound(float x,
                             float y,
                             int tolerance)
Checks if location symbol is found for the given coordinates and tolerance.

Parameters:
x - the screen coordinate along x axis in pixels.
y - the screen coordinate along y axis in pixels.
tolerance - tolerance in pixels.
Returns:
true if the location symbol is found.

isAllowNetworkLocation

public boolean isAllowNetworkLocation()
Checks if the network provider is allowed to determine the current location.

Returns:
whether the network (cellular network and WiFi if available) should be used to determine the current location.

setAllowNetworkLocation

public void setAllowNetworkLocation(boolean allowNetworkLocation)
Allow/disallow the usage of the network (cellular network and WiFi if available) to determine the current location

Parameters:
allowNetworkLocation - the flag for the usage of the network (default: true)

isAccuracyCircleOn

public boolean isAccuracyCircleOn()
Checks if the accuracy circle is on.

Returns:
true if the accuracy circle is on.

setAccuracyCircleOn

public void setAccuracyCircleOn(boolean accuracyCircleOn)
Enables/Disables the accuracy circle.

Parameters:
accuracyCircleOn - the accuracyCircleOn to set

setMaxAccuracyCircleSize

public void setMaxAccuracyCircleSize(int maxSize)
Sets the max accuracy circle size in meter. If the location fix's accuracy is beyond this limit, the accuracy circle will not grow wider and the circle outline will become red.

Parameters:
maxSize - size in meter.

getMaxAccuracyCircleSize

public int getMaxAccuracyCircleSize()
Gets the max accuracy circle size in meter.

Returns:
max accuracy circle size in meter.


Copyright © 2012. All Rights Reserved.