Accuracy issues when migrating from react-native-geolocation to react-native-background-geolocation
Environment
- Plugin version: 0.6.3
- Platform: Android
- OS version: Android 10 - API 29
- React Native info:
System:
OS: macOS 10.15.6
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 731.48 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.22.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.7 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 23, 25, 26, 27, 28, 29, 30
Build Tools: 26.0.2, 27.0.0, 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.2
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1
- Plugin configuration options:
{
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 50,
distanceFilter: 50,
notificationTitle: "App Name" ,
notificationText: "Desc",
debug: true,
startOnBoot: false,
stopOnTerminate: true,
locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
interval: 10000,
fastestInterval: 5000,
activitiesInterval: 10000,
stopOnStillActivity: false
}
Context
I'm migrating my APP from the react-native-Geolocation package to react-native-background-geolocation, as I need to get the location even when the app is in the background.
My app is related to physical activity and I need to display a polyline with the user's locations during a run. The problem is that before I received a latitude / longitude value in this format:
React-native-Geolocation: “latitude”: -22.74197324331078
and now:
React-native-background-Geolocation: “latitude”: -22.7419732
Even with BackgroundGeolocation.HIGH_ACCURACY, I can't get a latitude / longitude value with more decimal places. The consequence of this is that the polyline is not rendered on some android devices.
To render the polyline on the map I am using react-native-maps
Is there something wrong with my configuration object? Is there a way to get a more accurate latitude / longitude?
I'm trying to solve a bug in production and I really need to make it work.