Tuesday, 16 October 2018

react-native-background-geolocation not giving exact location while app is in background

I have used mauron85/react-native-background-geolocation for tracking the location of the user on my react native app. It is working fine while the app is on fore ground. The location is exact on regular interval. But if the app goes to background, the location is not the same, rather is moved from the previous location even though the device is not moved. Following is my configuration -

BackgroundGeolocation.configure({
    desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
    notificationTitle: 'Background tracking',
    notificationText: 'enabled',
    debug: false,
    startOnBoot: false,
    stopOnTerminate: false,
    locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
    interval: 40000,
    fastestInterval: 5000,
    activitiesInterval: 10000,
    stopOnStillActivity: false,
    url: 'http://192.168.81.15:3000/location',
    httpHeaders: {
        'X-FOO': 'bar'
    },
    // customize post properties
    postTemplate: {
        lat: '@latitude',
        lon: '@longitude',
        foo: 'bar' // you can also add your own properties
    }
});

What should I do to fix this issue?



from react-native-background-geolocation not giving exact location while app is in background

No comments:

Post a Comment