public class ReactiveLocationProvider
extends java.lang.Object
| Constructor and Description |
|---|
ReactiveLocationProvider(android.content.Context ctx) |
| Modifier and Type | Method and Description |
|---|---|
<any> |
addGeofences(android.app.PendingIntent geofenceTransitionPendingIntent,
GeofencingRequest request)
Creates observable that adds request and completes when the action is done.
|
<any> |
checkLocationSettings(LocationSettingsRequest locationRequest)
Observable that can be used to check settings state for given location request.
|
static <T extends Result> |
fromPendingResult(<any> result)
Util method that wraps
com.google.android.gms.common.api.PendingResult in Observable. |
<any> |
getCurrentPlace(PlaceFilter placeFilter)
Returns observable that fetches current place from Places API.
|
<any> |
getDetectedActivity(int detectIntervalMiliseconds)
Observable that can be used to observe activity provided by Actity Recognition mechanism.
|
<any> |
getGeocodeObservable(java.lang.String locationName,
int maxResults)
Creates observable that translates a street address or other description into a list of
possible addresses using included Geocoder class.
|
<any> |
getGeocodeObservable(java.lang.String locationName,
int maxResults,
LatLngBounds bounds)
Creates observable that translates a street address or other description into a list of
possible addresses using included Geocoder class.
|
<any> |
getGoogleApiClientObservable(Api... apis)
Observable that emits
com.google.android.gms.common.api.GoogleApiClient object after connection. |
<any> |
getLastKnownLocation()
Creates observable that obtains last known location and than completes.
|
<any> |
getPhotoForMetadata(PlacePhotoMetadata placePhotoMetadata)
Returns observable that fetches a placePhotoMetadata from the Places API using the place placePhotoMetadata metadata.
|
<any> |
getPhotoMetadataById(java.lang.String placeId)
Returns observable that fetches photo metadata from the Places API using the place ID.
|
<any> |
getPlaceAutocompletePredictions(java.lang.String query,
LatLngBounds bounds,
AutocompleteFilter filter)
Returns observable that fetches autocomplete predictions from Places API.
|
<any> |
getPlaceById(java.lang.String placeId)
Returns observable that fetches a place from the Places API using the place ID.
|
<any> |
getReverseGeocodeObservable(double lat,
double lng,
int maxResults)
Creates observable that translates latitude and longitude to list of possible addresses using
included Geocoder class.
|
<any> |
getReverseGeocodeObservable(java.util.Locale locale,
double lat,
double lng,
int maxResults)
Creates observable that translates latitude and longitude to list of possible addresses using
included Geocoder class.
|
<any> |
getUpdatedLocation(LocationRequest locationRequest)
Creates observable that allows to observe infinite stream of location updates.
|
<any> |
mockLocation(<any> sourceLocationObservable)
Returns an observable which activates mock location mode when subscribed to, using the
supplied observable as a source of mock locations.
|
<any> |
removeGeofences(java.util.List<java.lang.String> requestIds)
Observable that can be used to remove geofences from LocationClient.
|
<any> |
removeGeofences(android.app.PendingIntent pendingIntent)
Observable that can be used to remove geofences from LocationClient.
|
<any> |
removeLocationUpdates(android.app.PendingIntent intent)
Observable that can be used to remove
PendingIntent location updates. |
<any> |
requestLocationUpdates(LocationRequest locationRequest,
android.app.PendingIntent intent)
Creates an observable that adds a
PendingIntent as a location listener. |
public ReactiveLocationProvider(android.content.Context ctx)
public <any> getLastKnownLocation()
GoogleAPIConnectionException
when there are trouble connecting with Google Play Services and other exceptions that
can be thrown on com.google.android.gms.location.FusedLocationProviderApi#getLastLocation(com.google.android.gms.common.api.GoogleApiClient).
Everything is delivered by rx.Observer#onError(Throwable).public <any> getUpdatedLocation(LocationRequest locationRequest)
GoogleAPIConnectionException
when there are trouble connecting with Google Play Services and other exceptions that
can be thrown on com.google.android.gms.location.FusedLocationProviderApi#requestLocationUpdates(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location.LocationRequest, com.google.android.gms.location.LocationListener).
Everything is delivered by rx.Observer#onError(Throwable).locationRequest - request object with info about what kind of location you needpublic <any> mockLocation(<any> sourceLocationObservable)
SecurityException
will be thrown.
All statuses that are not successful will be reported as StatusException.
Every exception is delivered by rx.Observer#onError(Throwable).sourceLocationObservable - observable that emits Location instances suitable to use as mock locationscom.google.android.gms.common.api.Statuspublic <any> requestLocationUpdates(LocationRequest locationRequest,
android.app.PendingIntent intent)
PendingIntent as a location listener.
This invokes com.google.android.gms.location.FusedLocationProviderApi#requestLocationUpdates(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location.LocationRequest, android.app.PendingIntent).
When location updates are no longer required, a call to removeLocationUpdates(android.app.PendingIntent)
should be made.
In case of unsuccessful status StatusException is delivered.locationRequest - request object with info about what kind of location you needintent - PendingIntent that will be called with location updatespublic <any> removeLocationUpdates(android.app.PendingIntent intent)
PendingIntent location updates.
In case of unsuccessful status StatusException is delivered.intent - PendingIntent to remove location updates forpublic <any> getReverseGeocodeObservable(double lat,
double lng,
int maxResults)
lat - latitudelng - longitudemaxResults - maximal number of results you are interested inpublic <any> getReverseGeocodeObservable(java.util.Locale locale,
double lat,
double lng,
int maxResults)
locale - locale for address languagelat - latitudelng - longitudemaxResults - maximal number of results you are interested inpublic <any> getGeocodeObservable(java.lang.String locationName,
int maxResults)
locationName - a user-supplied description of a locationmaxResults - max number of results you are interested inpublic <any> getGeocodeObservable(java.lang.String locationName,
int maxResults,
LatLngBounds bounds)
locationName - a user-supplied description of a locationmaxResults - max number of results you are interested inbounds - restricts the results to geographical bounds. May be nullpublic <any> addGeofences(android.app.PendingIntent geofenceTransitionPendingIntent,
GeofencingRequest request)
GoogleAPIConnectionException
when there are trouble connecting with Google Play Services.
In case of unsuccessful status StatusException is delivered.
Other exceptions will be reported that can be thrown on com.google.android.gms.location.GeofencingApi#addGeofences(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location.GeofencingRequest, android.app.PendingIntent)geofenceTransitionPendingIntent - pending intent to register on geofence transitionrequest - list of request to addpublic <any> removeGeofences(android.app.PendingIntent pendingIntent)
StatusException is delivered.
Other exceptions will be reported that can be thrown on com.google.android.gms.location.GeofencingApi#removeGeofences(com.google.android.gms.common.api.GoogleApiClient, android.app.PendingIntent).
Every exception is delivered by rx.Observer#onError(Throwable).pendingIntent - key of registered geofencespublic <any> removeGeofences(java.util.List<java.lang.String> requestIds)
StatusException is delivered.
Other exceptions will be reported that can be thrown on com.google.android.gms.location.GeofencingApi#removeGeofences(com.google.android.gms.common.api.GoogleApiClient, java.util.List).
Every exception is delivered by rx.Observer#onError(Throwable).requestIds - geofences to removepublic <any> getDetectedActivity(int detectIntervalMiliseconds)
detectIntervalMiliseconds - detecion intervalpublic <any> checkLocationSettings(LocationSettingsRequest locationRequest)
locationRequest - location requestcom.google.android.gms.location.SettingsApipublic <any> getCurrentPlace(PlaceFilter placeFilter)
com.google.android.gms.location.places.PlaceLikelihood observable use
DataBufferObservable.placeFilter - filterpublic <any> getPlaceById(java.lang.String placeId)
placeId - id for placepublic <any> getPlaceAutocompletePredictions(java.lang.String query,
LatLngBounds bounds,
AutocompleteFilter filter)
com.google.android.gms.location.places.AutocompletePredictionBuffer you can use
DataBufferObservable.query - search querybounds - bounds where to fetch suggestions fromfilter - filterpublic <any> getPhotoMetadataById(java.lang.String placeId)
placeId - id for placepublic <any> getPhotoForMetadata(PlacePhotoMetadata placePhotoMetadata)
getPhotoMetadataById(String)placePhotoMetadata - the place photo meta datapublic <any> getGoogleApiClientObservable(Api... apis)
com.google.android.gms.common.api.GoogleApiClient object after connection.
In case of error GoogleAPIConnectionException is emmited.
When connection to Google Play Services is suspended GoogleAPIConnectionSuspendedException
is emitted as error.
Do not disconnect from apis client manually - just unsubscribe.apis - collection of apis to connect topublic static <T extends Result> <any> fromPendingResult(<any> result)
com.google.android.gms.common.api.PendingResult in Observable.T - parameter type of resultresult - pending result to wrap