Speedup location via gms

This commit is contained in:
max-klaus 2021-02-06 13:08:43 +03:00
parent 9eae17f0d3
commit 9efe8ffd0a
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 // Sets the fastest rate for active location updates. This interval is exact, and your
// application will never receive updates more frequently than this value. // 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 // Sets the maximum time when batched location updates are delivered. Updates may be
// delivered sooner than this interval. // delivered sooner than this interval.
.setMaxWaitTime(200) .setMaxWaitTime(0)
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

View file

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