-
- All Implemented Interfaces:
-
android.hardware.SensorEventListener,android.location.LocationListener
public final class LocationManager implements LocationListener, SensorEventListener
Manager class that encapsulates location and heading updates.
This class uses Android's LocationManager to receive location updates and registers a sensor listener on the rotation vector to mimic heading updates.
-
-
Constructor Summary
Constructors Constructor Description LocationManager(Context context, DataManager dataManager)
-
Method Summary
Modifier and Type Method Description final UnitstartUpdates()Begin recording updates. final UnitstopUpdates()Stop recording updates. UnitonLocationChanged(Location location)Called when a new location update is available. UnitonStatusChanged(String provider, Integer status, Bundle extras)UnitonProviderEnabled(String provider)UnitonProviderDisabled(String provider)UnitonSensorChanged(SensorEvent event)Called when the rotation vector sensor provides a new reading. UnitonAccuracyChanged(Sensor sensor, Integer accuracy)final Unitshutdown()Clean-up: call this when you no longer need location or sensor updates. final UnitapplyConfig(LocationConfiguration config)-
-
Constructor Detail
-
LocationManager
LocationManager(Context context, DataManager dataManager)
-
-
Method Detail
-
startUpdates
final Unit startUpdates()
Begin recording updates.
-
stopUpdates
final Unit stopUpdates()
Stop recording updates.
-
onLocationChanged
Unit onLocationChanged(Location location)
Called when a new location update is available.
-
onStatusChanged
Unit onStatusChanged(String provider, Integer status, Bundle extras)
-
onProviderEnabled
Unit onProviderEnabled(String provider)
-
onProviderDisabled
Unit onProviderDisabled(String provider)
-
onSensorChanged
Unit onSensorChanged(SensorEvent event)
Called when the rotation vector sensor provides a new reading. We convert this sensor event into a heading update.
-
onAccuracyChanged
Unit onAccuracyChanged(Sensor sensor, Integer accuracy)
-
shutdown
final Unit shutdown()
Clean-up: call this when you no longer need location or sensor updates.
-
applyConfig
final Unit applyConfig(LocationConfiguration config)
-
-
-
-