Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background location tracking is working but onLocation event is not updating on iOS and Android. #2189

Open
murtaza-rizvi-inc opened this issue Oct 25, 2024 · 1 comment

Comments

@murtaza-rizvi-inc
Copy link

murtaza-rizvi-inc commented Oct 25, 2024

Your Environment

  • Plugin version: ^4.17.2
  • Platform: iOS or Android
  • OS version: Both
  • Device manufacturer / model: iPhone X and Samsung S9, Samsung A30
  • React Native version (react-native -v): 0.75.4
  • Plugin config
`BackgroundGeolocation.ready(
      {
        desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
        activityType: BackgroundGeolocation.ACTIVITY_TYPE_OTHER_NAVIGATION,
        // distanceFilter: isIOS ? 100 : 0,
        distanceFilter: 5,
        stopTimeout: 5,
        stationaryRadius: 0,
        preventSuspend: true,
        stopOnTerminate: false, // Continue tracking after app termination
        startOnBoot: true, // Start tracking when the device boots up
        foregroundService: true, // Optional: run as a foreground service
        debug: false, // Set true for debugging (shows notifications)
        logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, // Log level for debugging notificationTitle: 'Tracking Location',
        enableHeadless: true,
        notification: {
          title: 'Location Tracking',
          text: 'Tracking your location...',
          channelName: 'Location Tracking',
          priority: BackgroundGeolocation.NOTIFICATION_PRIORITY_HIGH,
        },
      },
      async state => {
        console.log('STATE  #####: ', state);
        const storedLoadId = await AsyncStorage.getData('loadId');
        if (state.didLaunchInBackground && state.enabled && isIOS) {
          setIsTracking(state.enabled);
          loadId = storedLoadId;
          setLoadBeingTracked(storedLoadId);
        } else {
          setIsTracking(state.enabled);
          setLoadBeingTracked(storedLoadId);
        }
      },
    );`

Expected Behavior

After location update onLocation event should work

Actual Behavior

After location updates onLocation event is not triggered

Steps to Reproduce

Context

I'm trying to send a API call (code is in onLocation event) after every location update
P.S I haven't bought the license key yet I'm still testing and I'm not satisfied yet.

Debug logs

Logs
PASTE_YOUR_LOGS_HERE
@christocracy
Copy link
Member

debug: false

See wiki “Debugging” and learn to observe the logs. Learn about what the debug soundFX mean in api docs Config.debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants