react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Can't get userLocation to update consistently in background mode and forground
Your Environment
- Plugin version: 4.11.1
- Platform: Android
- OS version: 16.4
- Device manufacturer / model: android 10
- React Native version (
react-native -v): 0.71.6 - Plugin config
import ReactNativeForegroundService from '@supersami/rn-foreground-service';
import BackgroundGeolocation from 'react-native-background-geolocation';
const startLocationTracking = async () => {
// Request necessary permissions for accessing user's location
if (Platform.OS === 'android') {
await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION,
]);
}
ReactNativeForegroundService.start({
id: 144,
title: 'Location Tracking',
message: 'Track location in background mode',
});
BackgroundGeolocation.ready(
{
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 0,
distanceFilter: 0,
startForeground: true,
notification: {title: 'Background Tracking', text: 'enabled'},
debug: false,
startOnBoot: true,
stopOnTerminate: false,
locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
locationUpdateInterval: 60 * 1000, // 1 minute
interval: 60 * 1000, // 1 minute
fastestInterval: 30 * 1000,
stopOnStillActivity: false,
},
state => {
console.log('BackgroundGeolocation is ready:', state.enabled);
BackgroundGeolocation.start();
},
);
BackgroundGeolocation.on('location', async location => {
console.log(location);
// await readData(location);
});
};
Expected Behavior
Actual Behavior
Steps to Reproduce
Context
Debug logs
Logs
PASTE_YOUR_LOGS_HERE
Device manufacturer / model: android 10
Invalid information. What is the exact "Device Manufacturer and Model"?
The following config options are invalid. You probably migrated from the mauron85 version.
locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER, startForeground: true interval: 60 * 1000, // 1 minute fastestInterval: 30 * 1000, stopOnStillActivity: false,
See Wiki Debugging.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.