public class

LocationTracker

extends Object
java.lang.Object
   ↳ sofia.gps.LocationTracker

Class Overview

TODO document

Summary

Nested Classes
enum LocationTracker.Accuracy Indicates the desired accuracy used for location tracking. 
enum LocationTracker.Power TODO comment  
Public Constructors
LocationTracker(Activity context)
Creates a new LocationTracker that sends its location notifications to the specified context (such as a Screen or Activity).
Public Methods
LocationTracker.Accuracy getAccuracy()
Gets the desired accuracy (fine or coarse) of the location tracker.
double getMinimumDistance()
Gets the minimum distance, in meters, that the user must travel before another location notification is sent.
LocationTracker.Power getPowerRequirement()
Gets the maximum power level that can be used to track the user's location.
double getTimeInterval()
Gets the minimum amount of time, in seconds, that should pass between location notifications.
boolean isAltitudeRequired()
Gets a value indicating whether the user's altitude must be reported along with his or her geographical location.
boolean isBearingRequired()
Gets a value indicating whether the user's bearing (compass direction) must be reported along with his or her geographical location.
boolean isCostAllowed()
Gets a value indicating whether monetary costs (such as data charges) may be incurred in order to track the user's location.
boolean isSpeedRequired()
Gets a value indicating whether the user's speed should be reported in addition to his or her geographical position.
boolean isTracking()
Gets a value indicating whether location tracking is currently active.
boolean isTrackingPossible()
Gets a value indicating whether the current device is capable of tracking locations, using either GPS hardware or wireless networks.
void presentLocationSettings()

Presents the GPS options screen to the user.

void setAccuracy(LocationTracker.Accuracy accuracy)
Sets the desired accuracy (fine or coarse) of the location tracker.
void setAltitudeRequired(boolean altitude)
Sets a value indicating whether the user's altitude must be reported along with his or her geographical location.
void setBearingRequired(boolean bearing)
Sets a value indicating whether the user's bearing (compass direction) must be reported along with his or her geographical location.
void setCostAllowed(boolean cost)
Sets a value indicating whether monetary costs (such as data charges) may be incurred in order to track the user's location.
void setMinimumDistance(double distance)
Sets the minimum distance, in meters, that the user must travel before another location notification is sent.
void setPowerRequirement(LocationTracker.Power power)
Sets the maximum power level that can be used to track the user's location.
void setSpeedRequired(boolean speed)
Sets a value indicating that the user's speed should be reported in addition to his or her geographical position.
void setTimeInterval(double seconds)
Sets the minimum amount of time, in seconds, that should pass between location notifications.
void startTracking()

Begins tracking the user's location.

void stopTracking()

Stops tracking the user's location.

[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public LocationTracker (Activity context)

Creates a new LocationTracker that sends its location notifications to the specified context (such as a Screen or Activity).

Parameters
context the context (screen or activity) that will receive the location notifications

Public Methods

public LocationTracker.Accuracy getAccuracy ()

Gets the desired accuracy (fine or coarse) of the location tracker.

Returns

public double getMinimumDistance ()

Gets the minimum distance, in meters, that the user must travel before another location notification is sent.

Returns
  • the minimum distance, in meters, that the user must travel before another location notification is sent

public LocationTracker.Power getPowerRequirement ()

Gets the maximum power level that can be used to track the user's location.

Returns

public double getTimeInterval ()

Gets the minimum amount of time, in seconds, that should pass between location notifications. Applications that need to track the user's location in real-time (for example, to display it in an active GUI), should set this low with the understanding that it will put more strain on the battery.

Returns
  • the minimum amount of time, in seconds, that should pass between location notifications

public boolean isAltitudeRequired ()

Gets a value indicating whether the user's altitude must be reported along with his or her geographical location. Not all devices and location providers are able to provide this information.

Returns
  • true if altitude information is required, otherwise false

public boolean isBearingRequired ()

Gets a value indicating whether the user's bearing (compass direction) must be reported along with his or her geographical location. Not all devices and location providers are able to provide this information.

Returns
  • true if bearing information is required, otherwise false

public boolean isCostAllowed ()

Gets a value indicating whether monetary costs (such as data charges) may be incurred in order to track the user's location.

Returns
  • true if monetary costs may be incurred in order to track the user's location, otherwise false

public boolean isSpeedRequired ()

Gets a value indicating whether the user's speed should be reported in addition to his or her geographical position. Not all devices and location providers are able to provide this information.

Returns
  • true if speed information is required, otherwise false

public boolean isTracking ()

Gets a value indicating whether location tracking is currently active.

Returns
  • true if location tracking is currently active, otherwise false

public boolean isTrackingPossible ()

Gets a value indicating whether the current device is capable of tracking locations, using either GPS hardware or wireless networks.

Returns
  • true if the current device is capable of tracking locations, otherwise false

public void presentLocationSettings ()

Presents the GPS options screen to the user. Applications that use the location tracker should make this screen available in some way so that users can enable/disable GPS if needed.

When the user has finished configuring the tracker, the gpsOptionsDidFinish method will be called on the owning activity.

public void setAccuracy (LocationTracker.Accuracy accuracy)

Sets the desired accuracy (fine or coarse) of the location tracker.

Parameters
accuracy the desired LocationTracker.Accuracy of the location tracker

public void setAltitudeRequired (boolean altitude)

Sets a value indicating whether the user's altitude must be reported along with his or her geographical location. Not all devices and location providers are able to provide this information.

Parameters
altitude true if altitude information is required, otherwise false

public void setBearingRequired (boolean bearing)

Sets a value indicating whether the user's bearing (compass direction) must be reported along with his or her geographical location. Not all devices and location providers are able to provide this information.

Parameters
bearing true if bearing information is required, otherwise false

public void setCostAllowed (boolean cost)

Sets a value indicating whether monetary costs (such as data charges) may be incurred in order to track the user's location.

Parameters
cost true if monetary costs may be incurred in order to track the user's location, otherwise false

public void setMinimumDistance (double distance)

Sets the minimum distance, in meters, that the user must travel before another location notification is sent.

Parameters
distance the minimum distance, in meters, that the user must travel before another location notification is sent

public void setPowerRequirement (LocationTracker.Power power)

Sets the maximum power level that can be used to track the user's location.

Parameters
power the maximum LocationTracker.Power level that can be used to track the user's location

public void setSpeedRequired (boolean speed)

Sets a value indicating that the user's speed should be reported in addition to his or her geographical position. Not all devices and location providers are able to provide this information.

Parameters
speed true if speed information is required, otherwise false

public void setTimeInterval (double seconds)

Sets the minimum amount of time, in seconds, that should pass between location notifications. Applications that need to track the user's location in real-time (for example, to display it in an active GUI), should set this low with the understanding that it will put more strain on the battery.

Parameters
seconds the minimum amount of time, in seconds, that should pass between location notifications

public void startTracking ()

Begins tracking the user's location.

If this LocationTracker's context is a Sofia Screen, then tracking will automatically be stopped when the screen is paused (leaves the display) and restarted when the screen is resumed.

public void stopTracking ()

Stops tracking the user's location.

If this LocationTracker's context is a Screen, then this method is called automatically when that screen is paused (removed from the display). You can call it directly if you wish to stop tracking at some other point (such as when a destination is reached, or if the user requests it).