I want to get GPS information at distance intervals.

Asked 2 years ago, Updated 2 years ago, 297 views

I am currently creating an Android app on Kotlin, but I want to use the FusedLocationProviderClient to get GPS information at regular distance intervals, but I can't get it well.
It's natural that it's not accurate because of the desired value, but even if you specify 10m, it can be more than 50m.
Is the setting wrong?
I would appreciate it if you could point it out.

private funcreateLocationRequest():LocationRequest?{
    return LocationRequest.create()?apply{
        setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
        setSmartDisplacement (10F)
        // setFastestInterval (100000)
        // setInterval (5000)
    }

}

android kotlin gps

2022-09-30 22:03

1 Answers

setSmartDisplacement

This method is

Set the minimum replacement between location updates in meters

You set the minimum instead of the maximum, so

10m is over 50m

is completely up to specification and there is no problem.


2022-09-30 22:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.