Speedup location via gms

This commit is contained in:
max-klaus 2021-02-06 13:08:43 +03:00
parent 8c2e506105
commit 1b9eb9a6e1
2 changed files with 5 additions and 3 deletions

View file

@ -63,11 +63,11 @@ public class LocationServiceHelperImpl extends LocationServiceHelper {
// Sets the fastest rate for active location updates. This interval is exact, and your
// application will never receive updates more frequently than this value.
.setFastestInterval(50)
//.setFastestInterval(50)
// Sets the maximum time when batched location updates are delivered. Updates may be
// delivered sooner than this interval.
.setMaxWaitTime(200)
.setMaxWaitTime(0)
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

View file

@ -130,7 +130,9 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
canvas.restore();
}
// Issue 5538: Some devices return positives for hasBearing() at rest, hence add 0.0 check:
boolean isBearing = lastKnownLocation.hasBearing() && (lastKnownLocation.getBearing() != 0.0);
boolean isBearing = lastKnownLocation.hasBearing() && (lastKnownLocation.getBearing() != 0.0)
&& (!lastKnownLocation.hasSpeed() || lastKnownLocation.getSpeed() > 0.1);
if (!locationOutdated && isBearing) {
float bearing = lastKnownLocation.getBearing();
canvas.rotate(bearing - 90, locationX, locationY);