Improve tracker location

This commit is contained in:
max-klaus 2021-02-26 18:00:16 +03:00
parent 481feec24d
commit 477365f27a
3 changed files with 4 additions and 8 deletions

View file

@ -46,8 +46,8 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
private var fusedLocationProviderClient: FusedLocationProviderClient? = null private var fusedLocationProviderClient: FusedLocationProviderClient? = null
private val locationRequest = LocationRequest().apply { private val locationRequest = LocationRequest().apply {
interval = 1000 interval = 1000
fastestInterval = 500 //fastestInterval = 500
maxWaitTime = 2000 maxWaitTime = 0
priority = LocationRequest.PRIORITY_HIGH_ACCURACY priority = LocationRequest.PRIORITY_HIGH_ACCURACY
} }
private val locationCallback = object : LocationCallback() { private val locationCallback = object : LocationCallback() {

View file

@ -82,11 +82,11 @@ class TelegramService : Service(), TelegramIncomingMessagesListener,
// 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.
fastestInterval = 500 //fastestInterval = 500
// 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.
maxWaitTime = 2000 maxWaitTime = 0
priority = LocationRequest.PRIORITY_HIGH_ACCURACY priority = LocationRequest.PRIORITY_HIGH_ACCURACY
} }

View file

@ -13,7 +13,6 @@ import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices; import com.google.android.gms.location.LocationServices;
import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.plus.helpers.DayNightHelper; import net.osmand.plus.helpers.DayNightHelper;
@ -22,9 +21,6 @@ import net.osmand.plus.helpers.LocationServiceHelper;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import java.util.Collections; import java.util.Collections;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class LocationServiceHelperImpl extends LocationServiceHelper { public class LocationServiceHelperImpl extends LocationServiceHelper {