public class GpsMyLocationProvider extends Object implements IMyLocationProvider, LocationListener
LocationManager.GPS_PROVIDER
and LocationManager.NETWORK_PROVIDER
Constructor and Description |
---|
GpsMyLocationProvider(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
addLocationSource(String source)
adds a new source to listen for location data.
|
void |
clearLocationSources()
removes all sources, again, only useful before startLocationProvider is called
|
void |
destroy() |
Location |
getLastKnownLocation() |
Set<String> |
getLocationSources()
returns the live list of GPS sources that we accept, changing this list after startLocationProvider
has no effect unless startLocationProvider is called again
|
float |
getLocationUpdateMinDistance() |
long |
getLocationUpdateMinTime() |
void |
onLocationChanged(Location location) |
void |
onProviderDisabled(String provider) |
void |
onProviderEnabled(String provider) |
void |
onStatusChanged(String provider,
int status,
Bundle extras) |
void |
setLocationUpdateMinDistance(float meters)
Set the minimum distance for location updates.
|
void |
setLocationUpdateMinTime(long milliSeconds)
Set the minimum interval for location updates.
|
boolean |
startLocationProvider(IMyLocationConsumer myLocationConsumer)
Enable location updates and show your current location on the map.
|
void |
stopLocationProvider() |
public GpsMyLocationProvider(Context context)
public void clearLocationSources()
public void addLocationSource(String source)
public Set<String> getLocationSources()
public long getLocationUpdateMinTime()
public void setLocationUpdateMinTime(long milliSeconds)
LocationManager.requestLocationUpdates(String, long, float, LocationListener)
. Note
that you should call this before calling MyLocationNewOverlay.enableMyLocation()
.milliSeconds
- public float getLocationUpdateMinDistance()
public void setLocationUpdateMinDistance(float meters)
LocationManager.requestLocationUpdates(String, long, float, LocationListener)
. Note
that you should call this before calling MyLocationNewOverlay.enableMyLocation()
.meters
- public boolean startLocationProvider(IMyLocationConsumer myLocationConsumer)
setLocationUpdateMinTime(long)
and/or setLocationUpdateMinDistance(float)
before calling this method.startLocationProvider
in interface IMyLocationProvider
public void stopLocationProvider()
stopLocationProvider
in interface IMyLocationProvider
public Location getLastKnownLocation()
getLastKnownLocation
in interface IMyLocationProvider
public void destroy()
destroy
in interface IMyLocationProvider
public void onLocationChanged(Location location)
onLocationChanged
in interface LocationListener
public void onProviderDisabled(String provider)
onProviderDisabled
in interface LocationListener
public void onProviderEnabled(String provider)
onProviderEnabled
in interface LocationListener
public void onStatusChanged(String provider, int status, Bundle extras)
onStatusChanged
in interface LocationListener