Mapbox.getLocationEngine() instead.@Deprecated
public class LocationSource
extends com.mapbox.services.android.telemetry.location.LocationEngine
implements com.mapzen.android.lost.api.LostApiClient.ConnectionCallbacks, com.mapzen.android.lost.api.LocationListener
Note: If registering a listener in your Activity.onStart() implementation, you should unregister it in Activity.onStop(). (You won't receive location updates when paused, and this will cut down on unnecessary system overhead). Do not unregister in Activity.onSaveInstanceState(), because this won't be called if the user moves back in the history stack.
| Constructor and Description |
|---|
LocationSource()
Deprecated.
Constructs a location source instance.
|
LocationSource(android.content.Context context)
Deprecated.
Constructs a location source instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Deprecated.
Activate the location engine which will connect whichever location provider you are using.
|
void |
deactivate()
Deprecated.
Disconnect the location engine which is useful when you no longer need location updates or requesting the users
LocationEngine.getLastLocation(). |
android.location.Location |
getLastLocation()
Deprecated.
Returns the Last known location is the location provider is connected and location permissions are granted.
|
boolean |
isConnected()
Deprecated.
Check if your location provider has been activated/connected.
|
com.mapbox.services.android.telemetry.location.LocationEngine.Type |
obtainType()
Deprecated.
Returns the location engine type.
|
void |
onConnected()
Deprecated.
Invoked when the location provider has connected.
|
void |
onConnectionSuspended()
Deprecated.
Invoked when the location provider connection has been suspended.
|
void |
onLocationChanged(android.location.Location location)
Deprecated.
Invoked when the Location has changed.
|
void |
removeLocationUpdates()
Deprecated.
Dismiss ongoing location update to the location provider.
|
void |
requestLocationUpdates()
Deprecated.
Request location updates to the location provider.
|
addLocationEngineListener, getFastestInterval, getInterval, getPriority, getSmallestDisplacement, isBetterLocation, removeLocationEngineListener, setFastestInterval, setInterval, setPriority, setSmallestDisplacementpublic LocationSource(android.content.Context context)
context - the context from which the Application context will be derived.public LocationSource()
public void activate()
LocationEngine.requestLocationUpdates().activate in class com.mapbox.services.android.telemetry.location.LocationEnginepublic void deactivate()
LocationEngine.getLastLocation(). Before deactivating, you'll need to stop request user location updates
using LocationEngine.removeLocationUpdates().deactivate in class com.mapbox.services.android.telemetry.location.LocationEnginepublic boolean isConnected()
isConnected in class com.mapbox.services.android.telemetry.location.LocationEnginepublic void onConnected()
onConnected in interface com.mapzen.android.lost.api.LostApiClient.ConnectionCallbackspublic void onConnectionSuspended()
onConnectionSuspended in interface com.mapzen.android.lost.api.LostApiClient.ConnectionCallbacks@Nullable public android.location.Location getLastLocation()
getLastLocation in class com.mapbox.services.android.telemetry.location.LocationEnginepublic void requestLocationUpdates()
requestLocationUpdates in class com.mapbox.services.android.telemetry.location.LocationEnginepublic void removeLocationUpdates()
removeLocationUpdates in class com.mapbox.services.android.telemetry.location.LocationEnginepublic com.mapbox.services.android.telemetry.location.LocationEngine.Type obtainType()
obtainType in class com.mapbox.services.android.telemetry.location.LocationEnginepublic void onLocationChanged(android.location.Location location)
onLocationChanged in interface com.mapzen.android.lost.api.LocationListenerlocation - the new location