AI-generated Key Takeaways
-
RoadSnappedLocationProvider.LocationListenerdefines methods called when road-snapped location updates are available, with all notifications occurring on the UI thread. -
It includes methods like
onLocationChanged, providing road-snapped locations as frequently as possible (primarily in driving mode), andonRawLocationUpdatefor raw location events. -
The
IS_ROAD_SNAPPED_KEYconstant, accessible vialocation.getExtras().getBoolean(LocationListener.IS_ROAD_SNAPPED_KEY), indicates whether a location was snapped to a road (with potential for occasional inaccuracies). -
onLocationChangedis called when the user's location is updated, providing the driver's location, which includes theIS_ROAD_SNAPPED_KEYBundle key if available. -
onRawLocationUpdateis called when raw location events are sent, which may occur when road-snapped events are unavailable.
| Known Indirect Subclasses |
Defines signatures for methods that are called when road-snapped location updates become available. All notifications will occur on the UI thread.
Constant Summary
| String | IS_ROAD_SNAPPED_KEY | Bundle key for the Location object returned in onLocationChanged(Location). |
Public Method Summary
| abstract void |
onLocationChanged(Location location)
Called when the user's location is updated.
|
| void |
onRawLocationUpdate(Location location)
Called when raw location events are sent.
|
Constants
public static final String IS_ROAD_SNAPPED_KEY
Bundle key for the Location object returned in onLocationChanged(Location). When available,
maps to a boolean value that indicates whether the location was snapped to the best available
road. Note that this value may sometimes have hiccups and may differ from what aGMM UI shows.
Retrieve the value with location.getExtras().getBoolean(LocationListener.IS_ROAD_SNAPPED_KEY)
Public Methods
public abstract void onLocationChanged (Location location)
Called when the user's location is updated.
This is provided as frequently as possible by the location provider. Locations are only road-snapped when in driving mode, not when walking or cycling.
Parameters
| location | the driver's location. Contains IS_ROAD_SNAPPED Bundle key when information is available. |
|---|
public void onRawLocationUpdate (Location location)
Called when raw location events are sent. Empirically, we sometimes see these when the road-snapped events are not sent.
Parameters
| location | the driver's location. |
|---|