From 9efe8ffd0afc8cc39ad370eb74ef0e0831538fb1 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Sat, 6 Feb 2021 13:08:43 +0300 Subject: [PATCH] Speedup location via gms --- OsmAnd/src-gms/net/osmand/plus/LocationServiceHelperImpl.java | 4 ++-- .../src/net/osmand/plus/views/layers/PointLocationLayer.java | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src-gms/net/osmand/plus/LocationServiceHelperImpl.java b/OsmAnd/src-gms/net/osmand/plus/LocationServiceHelperImpl.java index 41c74012a3..eaab9e3d06 100644 --- a/OsmAnd/src-gms/net/osmand/plus/LocationServiceHelperImpl.java +++ b/OsmAnd/src-gms/net/osmand/plus/LocationServiceHelperImpl.java @@ -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); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/PointLocationLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/PointLocationLayer.java index 21dbbcc7bd..16952876a8 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/PointLocationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/PointLocationLayer.java @@ -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);