Post

Replies

Boosts

Views

Activity

Location interval on the iOS platform, with Flutter's Geolocator
Hey guys. I'm building a cross-platform app using Flutter, which uses the Geolocator package to see how far the user has travelled from their starting point, aviation related. I do allow the user to select their own distance filter value from a set of pre-defined options, which could be as low as a metre, since the app is designed for use over relatively small distances, from say 200m to 1km. Therefore, having a large distance filter value wouldn't make much sense. However, the issue I am having is that with iOS, I can't seem to control the actual sample rate of the user's location. From what I gather, iOS measures the user's location approximately once every second, give or take a bit, but that value cannot be changed. That's quite different to Android, where I can specify this measurement interval to be whatever I want it to be. This lack of ability to control the measurement interval tends to cause quite a lag. When someone first starts to move, they aren't travelling fast enough to cause a noticeable lag. However, when someone's speed picks up, they could be travelling at around 70mph/32m/s (ish). If you're only measuring the user's location once every second, then it's likely they will have travelled over 30m before the next location update, which means the lag distance could potentially be huge relative to the maximum distance they will measure using the app. I do fully appreciate that this is native functionality to iOS but my question really is, is there perhaps a way around this? Is there any way to increase the frequency with which the user's location is retrieved, so that I can reduce this lag? If there isn't, that's no problem at all. I just thought I would ask the question, incase someone has come across this before and found a solution that works. These are the Apple-related settings that I have been able to control with Flutter, for the Geolocator package. Thank you in advance! locationSettings = AppleSettings( accuracy: LocationAccuracy.bestForNavigation, activityType: ActivityType.otherNavigation, distanceFilter: distanceFilterValue, pauseLocationUpdatesAutomatically: false, showBackgroundLocationIndicator: false, );
2
0
465
Jul ’24