LocationCallback

public abstract class LocationCallback extends Object

Used for receiving notifications from the FusedLocationProviderApi when the device location has changed or can no longer be determined. The methods are called if the LocationCallback has been registered with the location client using the requestLocationUpdates(GoogleApiClient, LocationRequest, LocationCallback, Looper) method.

Public Constructor Summary

Public Method Summary

void
onLocationAvailability(LocationAvailability locationAvailability)
Called when there is a change in the availability of location data.
void
onLocationResult(LocationResult result)
Called when device location information is available.

Inherited Method Summary

Public Constructors

public LocationCallback ()

Public Methods

public void onLocationAvailability (LocationAvailability locationAvailability)

Called when there is a change in the availability of location data.

When isLocationAvailable() returns false you can assume that location will not be returned in onLocationResult(LocationResult) until something changes in the device's settings or environment. Even when isLocationAvailable() returns true the onLocationResult(LocationResult) may not always be called regularly, however the device location is known and both the most recently delivered location and getLastLocation(GoogleApiClient) will be reasonably up to date given the hints specified by the active LocationRequests.

Parameters
locationAvailability The current status of location availability.

public void onLocationResult (LocationResult result)

Called when device location information is available.

The most recent location returned by getLastLocation() is not guaranteed to be immediately fresh, but will be reasonably up to date given the hints specified by the active LocationRequests.

Parameters
result The latest location result available.