public class FusedUserLocationSource extends LocationCallback implements UserLocationSource
UserLocationSource
that uses Google's
com.google.android.gms.location.FusedLocationProviderClient
.UserLocationSource.LocationListener
Constructor and Description |
---|
FusedUserLocationSource(Context context)
Creates a new
FusedUserLocationSource with the default location request that asks for
a new location every 2 seconds with high priority. |
FusedUserLocationSource(Context context,
LocationRequest locationRequest)
Creates a new
FusedUserLocationSource with the given location request. |
Modifier and Type | Method and Description |
---|---|
void |
onLocationAvailability(LocationAvailability locationAvailability)
Invoked when the fused location provider notifies us that the location availability has
changed.
|
void |
onLocationResult(LocationResult locationResult)
Invoked when the fused location provider notifies us that the location has changed.
|
void |
setLocationListener(UserLocationSource.LocationListener listener)
Sets the listener to receive notifications when the location changes.
|
public FusedUserLocationSource(Context context, LocationRequest locationRequest)
FusedUserLocationSource
with the given location request.public FusedUserLocationSource(Context context)
FusedUserLocationSource
with the default location request that asks for
a new location every 2 seconds with high priority.public void setLocationListener(UserLocationSource.LocationListener listener)
UserLocationSource
null
to
remove it.setLocationListener
in interface UserLocationSource
public void onLocationResult(LocationResult locationResult)
public void onLocationAvailability(LocationAvailability locationAvailability)