-
- All Implemented Interfaces:
-
android.location.LocationListener,org.osmdroid.views.overlay.mylocation.IMyLocationProvider
public class GpsMyLocationProvider implements IMyLocationProvider, LocationListener
location provider, by default, uses GPS_PROVIDER and NETWORK_PROVIDER
-
-
Field Summary
Fields Modifier and Type Field Description private final Set<String>locationSources
-
Constructor Summary
Constructors Constructor Description GpsMyLocationProvider(Context context)
-
Method Summary
Modifier and Type Method Description Set<String>getLocationSources()returns the live list of GPS sources that we accept, changing this list after startLocationProviderhas no effect unless startLocationProvider is called again voidclearLocationSources()removes all sources, again, only useful before startLocationProvider is called voidaddLocationSource(String source)adds a new source to listen for location data. longgetLocationUpdateMinTime()voidsetLocationUpdateMinTime(long milliSeconds)Set the minimum interval for location updates. floatgetLocationUpdateMinDistance()voidsetLocationUpdateMinDistance(float meters)Set the minimum distance for location updates. booleanstartLocationProvider(IMyLocationConsumer myLocationConsumer)Enable location updates and show your current location on the map. voidstopLocationProvider()LocationgetLastKnownLocation()voiddestroy()voidonLocationChanged(Location location)voidonProviderDisabled(String provider)voidonProviderEnabled(String provider)voidonStatusChanged(String provider, int status, Bundle extras)-
-
Constructor Detail
-
GpsMyLocationProvider
GpsMyLocationProvider(Context context)
-
-
Method Detail
-
getLocationSources
Set<String> getLocationSources()
returns the live list of GPS sources that we accept, changing this list after startLocationProviderhas no effect unless startLocationProvider is called again
-
clearLocationSources
void clearLocationSources()
removes all sources, again, only useful before startLocationProvider is called
-
addLocationSource
void addLocationSource(String source)
adds a new source to listen for location data. Has no effect after startLocationProvider has been calledunless startLocationProvider is called again
-
getLocationUpdateMinTime
long getLocationUpdateMinTime()
-
setLocationUpdateMinTime
void setLocationUpdateMinTime(long milliSeconds)
Set the minimum interval for location updates. See requestLocationUpdates. Notethat you should call this before calling enableMyLocation.
-
getLocationUpdateMinDistance
float getLocationUpdateMinDistance()
-
setLocationUpdateMinDistance
void setLocationUpdateMinDistance(float meters)
Set the minimum distance for location updates. See requestLocationUpdates. Notethat you should call this before calling enableMyLocation.
-
startLocationProvider
boolean startLocationProvider(IMyLocationConsumer myLocationConsumer)
Enable location updates and show your current location on the map. By default this willrequest location updates as frequently as possible, but you can change the frequency and/ordistance by calling setLocationUpdateMinTime and/or before calling this method.
-
stopLocationProvider
void stopLocationProvider()
-
getLastKnownLocation
Location getLastKnownLocation()
-
destroy
void destroy()
-
onLocationChanged
void onLocationChanged(Location location)
-
onProviderDisabled
void onProviderDisabled(String provider)
-
onProviderEnabled
void onProviderEnabled(String provider)
-
onStatusChanged
void onStatusChanged(String provider, int status, Bundle extras)
-
-
-
-