public class FusedLocationProviderApiImpl extends java.lang.Object implements FusedLocationProviderApi, FusedLocationServiceConnectionManager.EventCallbacks, android.content.ServiceConnection
FusedLocationProviderApi.KEY_LOCATION_CHANGED| Constructor and Description |
|---|
FusedLocationProviderApiImpl(FusedLocationServiceConnectionManager connectionManager,
FusedLocationServiceCallbackManager callbackManager,
com.mapzen.android.lost.internal.RequestManager requestManager,
ClientManager clientManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionCallbacks(LostApiClient.ConnectionCallbacks callbacks) |
void |
connect(android.content.Context context,
LostApiClient.ConnectionCallbacks callbacks) |
void |
disconnect() |
android.location.Location |
getLastLocation(LostApiClient client)
Returns the best most recent location currently available.
|
LocationAvailability |
getLocationAvailability(LostApiClient client)
Returns the availability of location data.
|
java.util.Map<LostApiClient,java.util.Set<LocationListener>> |
getLocationListeners() |
boolean |
isConnected() |
boolean |
isConnecting() |
void |
onConnect(android.content.Context context) |
void |
onDisconnect() |
void |
onServiceConnected(android.content.ComponentName name,
android.os.IBinder binder) |
void |
onServiceConnected(android.os.IBinder binder) |
void |
onServiceDisconnected(android.content.ComponentName name) |
PendingResult<Status> |
removeLocationUpdates(LostApiClient client,
LocationCallback callback)
Remove location updates for the
LocationCallback |
PendingResult<Status> |
removeLocationUpdates(LostApiClient client,
LocationListener listener)
Removes location updates for the
LocationListener |
PendingResult<Status> |
removeLocationUpdates(LostApiClient client,
android.app.PendingIntent callbackIntent)
Removes location updates for the
PendingIntent |
PendingResult<Status> |
requestLocationUpdates(LostApiClient client,
LocationRequest request,
LocationCallback callback,
android.os.Looper looper)
Request location updates to be called on the
LocationCallback on a given thread. |
PendingResult<Status> |
requestLocationUpdates(LostApiClient client,
LocationRequest request,
LocationListener listener)
Request location updates to be called on the
LocationListener. |
PendingResult<Status> |
requestLocationUpdates(LostApiClient client,
LocationRequest request,
LocationListener listener,
android.os.Looper looper)
Request location updates to be called on the
LocationListener on a given thread. |
PendingResult<Status> |
requestLocationUpdates(LostApiClient client,
LocationRequest request,
android.app.PendingIntent callbackIntent)
Requests location updates with a callback on the specified PendingIntent.
|
PendingResult<Status> |
setMockLocation(LostApiClient client,
android.location.Location mockLocation)
Sets the mock location to be used for the location provider.
|
PendingResult<Status> |
setMockMode(LostApiClient client,
boolean isMockMode)
Sets whether or not the location provider is in mock mode.
|
PendingResult<Status> |
setMockTrace(LostApiClient client,
java.lang.String path,
java.lang.String filename)
Sets a mock trace file to be used to report location for the location provider.
|
public FusedLocationProviderApiImpl(FusedLocationServiceConnectionManager connectionManager, FusedLocationServiceCallbackManager callbackManager, com.mapzen.android.lost.internal.RequestManager requestManager, ClientManager clientManager)
public void onConnect(android.content.Context context)
onConnect in interface FusedLocationServiceConnectionManager.EventCallbackspublic void onServiceConnected(android.os.IBinder binder)
onServiceConnected in interface FusedLocationServiceConnectionManager.EventCallbackspublic void onDisconnect()
onDisconnect in interface FusedLocationServiceConnectionManager.EventCallbackspublic void onServiceConnected(android.content.ComponentName name,
android.os.IBinder binder)
onServiceConnected in interface android.content.ServiceConnectionpublic void onServiceDisconnected(android.content.ComponentName name)
onServiceDisconnected in interface android.content.ServiceConnectionpublic boolean isConnecting()
public void addConnectionCallbacks(LostApiClient.ConnectionCallbacks callbacks)
public void connect(android.content.Context context,
LostApiClient.ConnectionCallbacks callbacks)
public void disconnect()
public boolean isConnected()
public android.location.Location getLastLocation(LostApiClient client)
FusedLocationProviderApigetLastLocation in interface FusedLocationProviderApiclient - The client to return location for.public LocationAvailability getLocationAvailability(LostApiClient client)
FusedLocationProviderApiLocationManager has a last known GPS location
or
Network location is enabled and the LocationManager has a last known
Network location
This method can return null if there is a problem getting the availability.getLocationAvailability in interface FusedLocationProviderApiclient - The client to return availability for.public PendingResult<Status> requestLocationUpdates(LostApiClient client, LocationRequest request, LocationListener listener)
FusedLocationProviderApiLocationListener.
This method is suited for foreground use cases and callbacks for the LocationListener
will be made on the calling thread, which must already be a prepared looper thread. For
handling on a background thread it is recommended that you use the PendingIntent
version of this method FusedLocationProviderApi.requestLocationUpdates(LostApiClient,
LocationRequest, PendingIntent).requestLocationUpdates in interface FusedLocationProviderApiclient - Client to request updates for, must be connected when making this call.request - Specifies desired location accuracy, update interval, etc.listener - Listener to make calls on when location becomes available.PendingResult for the call to check whether call was successful.public PendingResult<Status> requestLocationUpdates(LostApiClient client, LocationRequest request, LocationListener listener, android.os.Looper looper)
FusedLocationProviderApiLocationListener on a given thread.
This method is suited for foreground use cases and callbacks for the LocationListener
will be made on the given thread, which must already be a prepared looper thread. For
handling on a background thread it is recommended that you use the PendingIntent
version of this method FusedLocationProviderApi.requestLocationUpdates(LostApiClient,
LocationRequest, PendingIntent).requestLocationUpdates in interface FusedLocationProviderApiclient - Client to request updates for, must be connected when making this call.request - Specifies desired location accuracy, update interval, etc.listener - Listener to make calls on when location becomes available.looper - Looper to implement the listener callbacks on.PendingResult for the call to check whether call was successful.public PendingResult<Status> requestLocationUpdates(LostApiClient client, LocationRequest request, LocationCallback callback, android.os.Looper looper)
FusedLocationProviderApiLocationCallback on a given thread.
This method is suited for foreground use cases and callbacks for the LocationCallback
will be made on the given thread, which must already be a prepared looper thread. For
handling on a background thread it is recommended that you use the PendingIntent
version of this method FusedLocationProviderApi.requestLocationUpdates(LostApiClient,
LocationRequest, PendingIntent).requestLocationUpdates in interface FusedLocationProviderApiclient - Client to request updates for, must be connected when making this call.request - Specifies desired location accuracy, update interval, etc.callback - Callback to make calls on when location becomes available.looper - Looper to implement the listener callbacks on.PendingResult for the call to check whether call was successful.public PendingResult<Status> requestLocationUpdates(LostApiClient client, LocationRequest request, android.app.PendingIntent callbackIntent)
FusedLocationProviderApiLocationListener &
LocationCallback) versions of this method.
Both LocationResult and LocationAvailability are sent with the
PendingIntent. You can extract them using
LocationResult.hasResult(android.content.Intent),
LocationResult.extractResult(android.content.Intent),
LocationAvailability.hasLocationAvailability(android.content.Intent), and
LocationAvailability.extractLocationAvailability(android.content.Intent).requestLocationUpdates in interface FusedLocationProviderApiclient - Client to request updates for, must be connected when making this call.request - Specifies desired location accuracy, update interval, etc.callbackIntent - Intent to be sent for each location update.PendingResult for the call to check whether call was successful.public PendingResult<Status> removeLocationUpdates(LostApiClient client, LocationListener listener)
FusedLocationProviderApiLocationListenerremoveLocationUpdates in interface FusedLocationProviderApiclient - Client which registered the listener. The client must be connected at the time
of this call.listener - Listener to remove updates for.PendingResult for the call to check whether call was successful.public PendingResult<Status> removeLocationUpdates(LostApiClient client, android.app.PendingIntent callbackIntent)
FusedLocationProviderApiPendingIntentremoveLocationUpdates in interface FusedLocationProviderApiclient - Client which registered the pending intent. The client must be connected at the
time of this call.callbackIntent - Intent to remove updates for.PendingResult for the call to check whether call was successful.public PendingResult<Status> removeLocationUpdates(LostApiClient client, LocationCallback callback)
FusedLocationProviderApiLocationCallbackremoveLocationUpdates in interface FusedLocationProviderApiclient - Client which registered the location callback. The client must be connected at
the time of this call.callback - Callback to remove updates for.PendingResult for the call to check whether call was successful.public PendingResult<Status> setMockMode(LostApiClient client, boolean isMockMode)
FusedLocationProviderApiLostApiClients connected to the FusedLocationProviderApi.
Mock mode must be enabled before clients are able to call
FusedLocationProviderApi.setMockLocation(LostApiClient, Location) and
FusedLocationProviderApi.setMockTrace(LostApiClient, String, String)setMockMode in interface FusedLocationProviderApiclient - Connected client.isMockMode - Whether mock mode should be enabled or not.PendingResult for the call to check whether call was successful.public PendingResult<Status> setMockLocation(LostApiClient client, android.location.Location mockLocation)
FusedLocationProviderApisetMockLocation in interface FusedLocationProviderApiclient - Connected client.mockLocation - Location to be set for the location provider.PendingResult for the call to check whether call was successful.public PendingResult<Status> setMockTrace(LostApiClient client, java.lang.String path, java.lang.String filename)
FusedLocationProviderApisetMockTrace in interface FusedLocationProviderApiclient - Connected client.path - storage directory containing GPX trace to be used to report location.filename - filename of GPX trace to be used to report location.PendingResult for the call to check whether call was successful.public java.util.Map<LostApiClient,java.util.Set<LocationListener>> getLocationListeners()