LocationCallback

Stay organized with collections Save and categorize content based on your preferences.
public abstract class LocationCallback extends Object

A callback for receiving notifications from the FusedLocationProviderClient.

Public Constructor Summary

Public Method Summary

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

Inherited Method Summary

Public Constructors

public LocationCallback ()

Public Methods

public void onLocationAvailability (LocationAvailability availability)

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

When LocationAvailability.isLocationAvailable() returns false it generally indicates that further invocations of onLocationResult(LocationResult) are unlikely until something changes with the device's settings or environment. When LocationAvailability.isLocationAvailable() returns true it generally indicates that further invocations of onLocationResult(LocationResult) are likely, and fresh locations can be expected.

Parameters
availability The latest location availability.

public void onLocationResult (LocationResult result)

Called when a new LocationResult is available. The locations within the location result will generally be as fresh as possible given the parameters of the associated LocationRequest and the state of the device, but this does not imply that they will always represent the current location. Clients may wish to reference the time associated with each location.

Parameters
result The latest location result.