Mapbox.getLocationEngine()
instead.@Deprecated public class LocationSource extends 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(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() . |
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.
|
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(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.
|
public LocationSource(Context context)
context
- the context from which the Application context will be derived.public LocationSource()
public void activate()
LocationEngine#requestLocationUpdates()
.public void deactivate()
LocationEngine#getLastLocation()
. Before deactivating, you'll need to stop request user location updates
using LocationEngine#removeLocationUpdates()
.public boolean isConnected()
public void onConnected()
onConnected
in interface com.mapzen.android.lost.api.LostApiClient.ConnectionCallbacks
public void onConnectionSuspended()
onConnectionSuspended
in interface com.mapzen.android.lost.api.LostApiClient.ConnectionCallbacks
@Nullable public Location getLastLocation()
public void requestLocationUpdates()
public void removeLocationUpdates()
public Type obtainType()
public void onLocationChanged(Location location)
onLocationChanged
in interface com.mapzen.android.lost.api.LocationListener
location
- the new location© 2015–2017 Mapbox. All rights reserved.