Open debugger22 opened 6 years ago
@mcharmas Hey could you please take a look at this issue.
Hi @debugger22,
to be honest I have no idea what can be the case here. Library is just a wrapper on play services and no state is shared between multiple instances of ReactiveLocationProvider
object.
It should not even matter if you are using multiple instances of ReactiveLocationProvider
vs one instance. For each locations subscription there is new connection to play services being made and data you get comes straight from location services.
If you want to get rid of duplicates you can merge these two observables and use distinct()
operator on the observable but be aware of memory implications. Maybe distinctUntilChanged()
will better for your use case? Having one subscription would be more elegant solution especially if you don't need a distinction where location is coming from.
First of all thanks for the awesome work on this library!
I recently ran into a strange issue. I am using two objects of
ReactiveLocationProvider
namelymReactiveLocationProviderActive
andmReactiveLocationProviderPassive
. The active one sends location updates only when the device moves a specified distance with an interval of 5 seconds whereas the passive one sends location updates every minute with no restriction on the displacement.It works in most cases except in some cases where it starts sending duplicate lat/lng. For example, look at the following table. The lat/lng pairs are same where as the accuracy is different.
It works perfectly fine when there is only a single object of
ReactiveLocationProvider
.Following is the code which I am using.
Library versions that I am using:
pl.charmas.android:android-reactive-location:0.9@aar
io.reactivex:rxjava:1.3.0
io.reactivex:rxandroid:1.2.1
com.google.android.gms:play-services-location:11.0.4
Any help would be highly appreciated. TIA.