react-native-background-geolocation: maxRecordsToPersist: 0 is not working

Environment:

  • Plugin version: 2.10.1
  • Platform: iOS
  • OS version: 11.2
  • Device manufacturer / model: iPhone emulator
  • React Native version: 0.47.2
  • Plugin config
  desiredAccuracy: 0,
  distanceFilter: 5,
  method: 'POST',
  url: https://linkexample.com,
  debug: true,
  autoSync: true, 
  stopOnTerminate: false,
  preventSuspend: true,
  startOnBoot: startOnBoot,
  httpRootProperty: '.',
  locationTemplate: '{"lat":<%= latitude %>, "lng":<%= longitude %>, "accuracy":<%= accuracy %>}',
  extras: {
    id: driverId,
    auth_key: token
  },
  maxRecordsToPersist: 0

Expected Behavior

After device lose internet connection it should do not collect location records to database.

Actual Behavior

Device keep collecting location records to the plugins SQLite DB and stopped moving.

Steps to Reproduce

I’ve chosen on iOS emulator -> Freeway Driving inside debug menu, so it should update location very often. When I add this row: maxRecordsToPersist: 0 emulator just stuck in one place and didn’t moved. But it’s keep collecting locations with coordinates, I saw that when I delete this row - it fill all the missed locations to my DB.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Why do you think it should send location to server? It won’t. You told it not to with maxRecordsToPersist: 0.

The plugin’s http service operates by fetching records from the database and executing http requests.

If there’s no records in the database, there’s no http requests.