@@ -9,6 +9,7 @@ class AndroidSettings extends LocationSettings {
9
9
///
10
10
/// The following default values are used:
11
11
/// - forceLocationManager: false
12
+ /// - enableAccuracyFilter: false
12
13
AndroidSettings ({
13
14
this .forceLocationManager = false ,
14
15
super .accuracy,
@@ -17,6 +18,7 @@ class AndroidSettings extends LocationSettings {
17
18
super .timeLimit,
18
19
this .foregroundNotificationConfig,
19
20
this .useMSLAltitude = false ,
21
+ this .enableAccuracyFilter = false ,
20
22
});
21
23
22
24
/// Forces the Geolocator plugin to use the legacy LocationManager instead of
@@ -71,6 +73,21 @@ class AndroidSettings extends LocationSettings {
71
73
/// Defaults to false
72
74
final bool useMSLAltitude;
73
75
76
+ /// Enables filtering for inaccurate GPS positions that might cause random GPS drift.
77
+ ///
78
+ /// When enabled, the plugin will filter out location updates that are physically implausible
79
+ /// based on speed, distance jumps, and accuracy thresholds. This is useful for applications
80
+ /// that require smooth location tracking without sudden jumps that can occur due to GPS
81
+ /// inaccuracies.
82
+ ///
83
+ /// The filter uses the following criteria to filter out problematic positions:
84
+ /// - Locations with very poor accuracy (> 300 meters)
85
+ /// - Unrealistically high speeds (> 280 m/s or ~1000 km/h)
86
+ /// - Large position jumps combined with poor accuracy
87
+ ///
88
+ /// Defaults to false
89
+ final bool enableAccuracyFilter;
90
+
74
91
@override
75
92
Map <String , dynamic > toJson () {
76
93
return super .toJson ()
@@ -79,6 +96,7 @@ class AndroidSettings extends LocationSettings {
79
96
'timeInterval' : intervalDuration? .inMilliseconds,
80
97
'foregroundNotificationConfig' : foregroundNotificationConfig? .toJson (),
81
98
'useMSLAltitude' : useMSLAltitude,
99
+ 'enableAccuracyFilter' : enableAccuracyFilter,
82
100
});
83
101
}
84
102
}
0 commit comments