Skip to content

BackgroundGeolocation.watchPosition() not gives regular location update on iOS simulator #481

@vikrantnegi

Description

@vikrantnegi

Using BackgroundGeolocation.watchPosition() on iOS simulator and using location debugging feature "Freeway drive" gives only one location.

Your Environment

  • Plugin version: 3.6.2
  • Platform: iOS
  • OS version: 13.3
  • Running in Simulator: Yes
  • React Native version: 0.61.5
  • Plugin configuration options:

Context

I'm getting is_moving: false maybe because of odometer not working on simulator and due to this it is not giving regular location updates.

Expected Behavior

Is there a way I can receive the location updates in iOS simulator since it normally works using native geolocation API?

Actual Behavior

I'm getting only single location on console from the simulator.

Steps to Reproduce

    // Traditional API still works:
    BackgroundGeolocation.ready({
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 50,
    })
      .then(state => {
        console.log('- BackgroundGeolocation is ready: ', state);
        BackgroundGeolocation.watchPosition(
          location => {
            console.log('[watchPosition] -', location);
            const {latitude, longitude, speed} = location.coords;
          },
          errorCode => {
            console.log('[watchPosition] ERROR -', errorCode);
          },
          {
            //interval: 1000,
            desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
            persist: true,
            extras: {foo: 'bar'},
            timeout: 60000,
          },
        );
      })
      .catch(error => {
        console.log('- BackgroundGeolocation error: ', error);
      });

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions