public class TuneLocationListener extends Object implements LocationListener
Constructor and Description |
---|
TuneLocationListener(Context context) |
Modifier and Type | Method and Description |
---|---|
Location |
getLastLocation()
Gets the last location
Asks for location updates if last location seen is not valid anymore
|
protected boolean |
isBetterLocation(Location location,
Location currentBestLocation)
Code from http://developer.android.com/guide/topics/location/strategies.html#BestEstimate
Determines whether one Location reading is better than the current Location fix
|
boolean |
isLocationEnabled()
Whether app has location permissions or not
|
boolean |
isProviderEnabled() |
void |
onLocationChanged(Location location) |
void |
onProviderDisabled(String provider) |
void |
onProviderEnabled(String provider) |
void |
onStatusChanged(String provider,
int status,
Bundle extras) |
void |
startListening()
Starts listening for location updates
|
void |
stopListening()
Stops listening for location updates
|
public TuneLocationListener(Context context)
public boolean isLocationEnabled()
public boolean isProviderEnabled()
public Location getLastLocation()
public void startListening()
public void stopListening()
protected boolean isBetterLocation(Location location, Location currentBestLocation)
location
- The new Location that you want to evaluatecurrentBestLocation
- The current Location fix, to which you want to compare the new onepublic void onLocationChanged(Location location)
onLocationChanged
in interface LocationListener
public void onStatusChanged(String provider, int status, Bundle extras)
onStatusChanged
in interface LocationListener
public void onProviderEnabled(String provider)
onProviderEnabled
in interface LocationListener
public void onProviderDisabled(String provider)
onProviderDisabled
in interface LocationListener