【发布时间】:2018-09-02 01:40:57
【问题描述】:
我的应用程序使用ReactiveLocationProvider 使用LocationRequest 对象获取位置更新。完整代码如下:
mLocationRequestPassive = LocationRequest.create();
mLocationRequestPassive.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mLocationRequestPassive.setFastestInterval(60000);
mLocationRequestPassive.setInterval(PASSIVE_UPDATE_PERIOD_IN_SECONDS * 1000);
mSubscriptions.add(mReactiveLocationProviderPassive
.getUpdatedLocation(mLocationRequestPassive)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::onLocationChanged,
throwable -> Timber.w(throwable,
"Location request error")));
它几乎可以工作 95% 的时间,但有时它会开始发送重复的 lat/lng。但是,准确度是不同的。它曾经发生在其他人身上吗?有什么解决办法吗?
我正在使用以下版本的库
compile 'pl.charmas.android:android-reactive-location:0.9@aar'compile 'com.google.android.gms:play-services-location:11.0.4'
更新
在此期间车辆正在移动。因此,添加 setSmallestDisplacement 只是将其从具有相同 lat/lng 的位置更新更改为没有位置更新。
【问题讨论】:
-
对不起,我忘了说这个。发生这种情况时,车辆在这段时间内移动。
-
请定义您希望看到的行为。
标签: android gps rx-java reactive-programming android-location