HERE Android SDK Developer's Guide

LocationDataSource

The class LocationDataSource is a member of com.here.android.mpa.common .

Class Summary

public abstract class LocationDataSource

extends java.lang.Object

Abstract class that defines the interface for providing positions updates from a location data source (e.g.

[For complete information, see the section Class Details]

Constructor Summary

Table 1. Constructors in LocationDataSource
Constructors

LocationDataSource ()

Creates a LocationDataSource instance

Method Summary

Table 2. Methods in LocationDataSource
Methods

public abstract int getGpsStatus ()

Called by PositioningManager to get the current LocationMethod::GPS location status.

public abstract int getIndoorStatus ()

Called by PositioningManager to get the current LocationMethod::INDOOR location status.

public abstract Location getLastKnownLocation ()

Called by PositioningManager to get the last known location.

public abstract int getNetworkStatus ()

Called by PositioningManager to get the current LocationMethod::NETWORK location status.

protected void onLocationUpdated (LocationMethod method, Location location)

Must be called by the derived class whenever the last known location is updated or the position fix has been lost.

protected void onStatusUpdated (LocationMethod method, int status)

Must be called by the derived class whenever the location status has been updated

public abstract boolean start (LocationMethod method)

Called by PositioningManager to start location updates using the specified location method.

public abstract void stop ()

Called by PositioningManager to stop location updates.

Class Details

Abstract class that defines the interface for providing positions updates from a location data source (e.g. an external GPS unit). Location data sources should provide a concrete implementation of this class and pass it to PositioningManager.start(LocationMethod).

Constructor Details

LocationDataSource ()

Creates a LocationDataSource instance

Method Details

public abstract int getGpsStatus ()

Called by PositioningManager to get the current LocationMethod::GPS location status.

Returns:

GPS location status. Return OUT_OF_SERVICE if LocationMethod::GPS is not supported for this location data source.

See also:

android.location.LocationProvider

public abstract int getIndoorStatus ()

Called by PositioningManager to get the current LocationMethod::INDOOR location status.

Returns:

Indoor location status. Return OUT_OF_SERVICE if LocationMethod::INDOOR is not supported for this location data source.

See also:

android.location.LocationProvider

public abstract Location getLastKnownLocation ()

Called by PositioningManager to get the last known location. Implement this to return the last known location using the "best" location method available for this location source. No guarantee regarding the freshness of the returned location is required.

Returns:

Last known location using best location method available. Return null if no location is available or if the position is lost.

public abstract int getNetworkStatus ()

Called by PositioningManager to get the current LocationMethod::NETWORK location status.

Returns:

Network location status. Return OUT_OF_SERVICE if LocationMethod::NETWORK is not supported for this location data source.

See also:

android.location.LocationProvider

protected void onLocationUpdated (LocationMethod method, Location location)

Must be called by the derived class whenever the last known location is updated or the position fix has been lost.

Parameters:

  • method

    Location method providing the update.

  • location

    Current location or null if the position has been lost.

protected void onStatusUpdated (LocationMethod method, int status)

Must be called by the derived class whenever the location status has been updated

Parameters:

  • method

    Location method that has an updated status.

  • status

    Updated status.

See also:

android.location.LocationProvider

public abstract boolean start (LocationMethod method)

Called by PositioningManager to start location updates using the specified location method.

Parameters:

  • method

    Location method(s) being requested. If the method requested is a combination of different methods (e.g. GPS_NETWORK_INDOOR) then only start position updates and return true if at least one of the methods (e.g. GPS) is available.

Returns:

True if location updates have been started using any of the methods requested. False otherwise.

public abstract void stop ()

Called by PositioningManager to stop location updates.