public class

LocationService

extends Object
java.lang.Object
   ↳ com.esri.android.map.LocationService

Class Overview

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

Summary

Public Methods
Location getLocation()
Returns the current location in the spatial reference WGS1984 (WKID=4326).
LocationListener getLocationListener()
Gets the Android LocationListener instance.
int getMaxAccuracyCircleSize()
Gets the max accuracy circle size in meter.
float getOpacity()
Gets the opacity of the location symbol.
Point getPoint()
Returns the current coordinates in the map's spatial reference.
Symbol getSymbol()
Gets the symbol.
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()
Checks if is auto pan.
boolean isBearingOn()
Checks if is bearing on.
boolean isStarted()
Checks if is started.
boolean isSymbolFound(float x, float y, int tolerance)
Checks if location symbol is found for the given coordinates and tolerance.
void pause()
Pause.
void registerDebugView(TextView debugView)
Register debug view.
void resume()
Resume.
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(LocationListener locationListener)
Sets the Android LocationListener instance.
void setMaxAccuracyCircleSize(int maxSize)
Sets the max accuracy circle size in meter.
void setOpacity(float opacity)
Sets the opacity of the location symbol.
void setSymbol(Symbol symbol)
Sets the symbol for location display.
void start()
Starts the LocationService.
void stop()
Stops the LocationService.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public Location getLocation ()

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

Returns
  • the current location Location.

public LocationListener getLocationListener ()

Gets the Android LocationListener instance.

Returns
  • the locationListener

public int getMaxAccuracyCircleSize ()

Gets the max accuracy circle size in meter.

Returns
  • max accuracy circle size in meter.

public float getOpacity ()

Gets the opacity of the location symbol.

Returns
  • the opacity.

public Point getPoint ()

Returns the current coordinates in the map's spatial reference.

Returns
  • the Point containing the coordinates.

public Symbol getSymbol ()

Gets the symbol.

Returns
  • the symbol used to represent the current location.

public boolean isAccuracyCircleOn ()

Checks if the accuracy circle is on.

Returns
  • true if the accuracy circle is on.

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.

public boolean isAutoPan ()

Checks if is auto pan.

Returns
  • whether the autoPan is activated or not.

public boolean isBearingOn ()

Checks if is bearing on.

Returns
  • whether the bearing (direction of travel) is taken into account.

public boolean isStarted ()

Checks if is started.

Returns
  • if the LocationService is activated.

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.

public void pause ()

Pause.

public void registerDebugView (TextView debugView)

Register debug view.

Parameters
debugView the debug view

public void resume ()

Resume.

public void setAccuracyCircleOn (boolean accuracyCircleOn)

Enables/Disables the accuracy circle.

Parameters
accuracyCircleOn the accuracyCircleOn to set

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)

public void setAutoPan (boolean autoPan)

activate/deactivate the autoPan.

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

public void setBearing (boolean bearing)

activate/deactivate the bearing representation.

Parameters
bearing flag for the bearing (default: true)

public void setLocationListener (LocationListener locationListener)

Sets the Android LocationListener instance.

Parameters
locationListener the locationListener to set

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.

public void setOpacity (float opacity)

Sets the opacity of the location symbol.

Returns
  • opacity the opacity.

public void setSymbol (Symbol symbol)

Sets the symbol for location display.

Parameters
symbol the symbol to set

public void start ()

Starts the LocationService.

public void stop ()

Stops the LocationService.