react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Can't get userLocation to update consistently in background mode and forground

Open Tushar9546 opened this issue 2 years ago • 2 comments

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

Tushar9546 avatar Apr 10 '23 04:04 Tushar9546

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.

christocracy avatar Apr 10 '23 15:04 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 23 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 06 '24 01:06 github-actions[bot]