HERE Android SDK Developer's Guide

PositioningManager

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

Class Summary

public final class PositioningManager

extends java.lang.Object

Represents a manager for information received from positioning devices, such as updates to the current position and the average speed.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in PositioningManager
Nested Classes

public static final enumeration PositioningManager.LocationMethod

Represents values describing the location method.

public static final enumeration PositioningManager.LocationStatus

Represents values describing the location status of a particular location method.

public static abstract interface PositioningManager.OnPositionChangedListener

Represents an interface for position update listeners.

Method Summary

Table 2. Methods in PositioningManager
Methods

public void addListener (java.lang.ref.WeakReference <OnPositionChangedListener> listener)

Adds a PositioningManager.OnPositionChangedListener to the PositioningManager .

public double getAverageSpeed ()

Gets the average speed of travel, in meters per second.

public static PositioningManager getInstance ()

Get access to the PositioningManager Singleton

public GeoPosition getLastKnownPosition ()

Returns the last known (cached) position from the best available provider.

public LocationMethod getLocationMethod ()

Gets the method type used to determine positioning.

public LocationStatus getLocationStatus (LocationMethod method)

Gets the status for a specified LocationMethod .

public GeoPosition getPosition ()

Gets the GeoPosition for the current PositioningManager.LocationMethod if available.

public boolean hasValidPosition ()

Determines whether the current position for the current active PositioningManager.LocationMethod is valid.

public boolean hasValidPosition (LocationMethod method)

Determines whether the current position for the specified LocationMethod is valid.

public boolean isActive ()

Determines whether the PositioningManager is active and whether position updates are being received.

public void removeListener (OnPositionChangedListener listener)

Removes a PositioningManager.OnPositionChangedListener from the PositioningManager .

public boolean start (LocationMethod method)

Starts receiving position updates from the positioning device.

public void stop ()

Stops receiving position updates from the positioning device.

Class Details

Represents a manager for information received from positioning devices, such as updates to the current position and the average speed.

Method Details

public void addListener (java.lang.ref.WeakReference <OnPositionChangedListener> listener)

Adds a PositioningManager.OnPositionChangedListener to the PositioningManager .

Parameters:

  • listener

    A OnPositionChangedListener to add

See also:

removeListener(OnPositionChangedListener)

public double getAverageSpeed ()

Gets the average speed of travel, in meters per second.

Returns:

The average speed

public static PositioningManager getInstance ()

Get access to the PositioningManager Singleton

Returns:

PositioningManager instance

public GeoPosition getLastKnownPosition ()

Returns the last known (cached) position from the best available provider. This is useful if there is no valid device position available (i.e. hasValidPosition() returns false). If hasValidPosition() returns true, please use the getPosition() API.

Returns:

Last known position from the best available provider.

See also:

getPosition()

public LocationMethod getLocationMethod ()

Gets the method type used to determine positioning.

Returns:

The LocationMethod

public LocationStatus getLocationStatus (LocationMethod method)

Gets the status for a specified LocationMethod .

Parameters:

  • method

    A LocationMethod used to determine the location status

Returns:

The status of the specified LocationMethod

public GeoPosition getPosition ()

Gets the GeoPosition for the current PositioningManager.LocationMethod if available.

Availability of a position can be checked by way of the hasValidPosition() method, if that method returns false, the best available cached position can be obtained using the getLastKnownPosition() API.

The position returned is determined by the following criteria:

Returns:

The current GeoPosition

See also:

getLastKnownPosition()

public boolean hasValidPosition ()

Determines whether the current position for the current active PositioningManager.LocationMethod is valid.

Returns:

True if the position is valid, false otherwise

See also:

hasValidPosition(LocationMethod)

public boolean hasValidPosition (LocationMethod method)

Determines whether the current position for the specified LocationMethod is valid.

Parameters:

  • method

    A LocationMethod to check for a valid position

Returns:

True if the position is valid, false otherwise

See also:

hasValidPosition()

public boolean isActive ()

Determines whether the PositioningManager is active and whether position updates are being received.

Returns:

True if the PositioningManager is actively receiving position updates, false otherwise

public void removeListener (OnPositionChangedListener listener)

Removes a PositioningManager.OnPositionChangedListener from the PositioningManager .

Parameters:

  • listener

    A OnPositionChangedListener to remove

See also:

addListener(WeakReference<OnPositionChangedListener>)

public boolean start (LocationMethod method)

Starts receiving position updates from the positioning device.

Parameters:

  • method

    A LocationMethod used to provide position updates

Returns:

True if position updates have started being received from the positioning device, false otherwise

public void stop ()

Stops receiving position updates from the positioning device.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.