Giter Club home page Giter Club logo

Comments (13)

christocracy avatar christocracy commented on August 23, 2024

Native location apis are not time-based -- they're distance-based. You're always bound by distanceFilter

Android's locationUpdateInterval merely controls how often a location is picked out of the location stream and sends to your app. It's still bound by distanceFilter.

from react-native-background-geolocation.

normanrz avatar normanrz commented on August 23, 2024

I know, I am more concerned about the interval that the data is sent to the server.

from react-native-background-geolocation.

christocracy avatar christocracy commented on August 23, 2024

Ah, I see. I think what you want is this allowDeferredUpdatesUntilTimeTravelled

I'm due to implement this. This is the final part of the CLLocationManager api which I have not yet implmented (few people requested it. I had someone on the Cordova side request this recently, so I'll go ahead and start implementing it soon)

from react-native-background-geolocation.

normanrz avatar normanrz commented on August 23, 2024

That sounds great! If I understand correctly that will limit the requests to a specified interval. but I would also be interested in always sending the current location every 5s (even if the location didnt change). like a heartbeat to the server.
would that be possible with this api? or would i need a background task for that?

from react-native-background-geolocation.

christocracy avatar christocracy commented on August 23, 2024

What is the nature of your app that you require a location at 1/5 Hz regardless of location-change?

from react-native-background-geolocation.

normanrz avatar normanrz commented on August 23, 2024

It is a realtime tracking app with fairly high precision. The frequency doesn't have to be 1/5 Hz, but I want to be able to tell if the tracking is still active or disconnected / app crashed.

from react-native-background-geolocation.

christocracy avatar christocracy commented on August 23, 2024

And when the user is sitting in a movie theatre for 2 hours, for example, what are your expectations?

from react-native-background-geolocation.

normanrz avatar normanrz commented on August 23, 2024

In our app the user will explicitly start/stop live tracking (except when they lose network connectivity, app crashes, battery dies etc.)

from react-native-background-geolocation.

christocracy avatar christocracy commented on August 23, 2024

Regarding iOS specifically, this module has 4 possible states:

  1. Stationary:. App is suspended. No code is running. No tracking.
  2. Moving: App is awake and actively recording a location each distanceFilter meters.
  3. Stop-detection:. Geolocation radios are off to conserve power. Module is aggressively monitoring the accelerometer for movement. This state can be engaged by a car stopped at a red light. If movement is detected (and the device has moved distanceFilter meters beyond last-location, State 2 is engaged. If stopTimeout expires, the module switches to State 1 or State 4 (if preventSuspend: true). During State 4, the module is cleverly preventing iOS from suspending the app by requesting 3 min background job from iOS. When a background job is nearly expired, the module briefly turns on location-updates, requests another 3 min background-job, then turns off location-updates again.
  4. Heartbeat: This is a specialized state enabled with preventSuspend: true, heartbeatInterval: {Integer seconds}. This state hi-jacks iOS's natural desire to suspend an app when location-services are powered down, keeping the CPU spinning indefinitely by requesting background-jobs as described in State 3. During this state, the accelerometer is sampled at 1Hz. If any movement as all is detected after a heartbeatInterval, the location-radios will engage at full power and a very high-quality location is requested. If the device is determined to be moving (ie: speed is reported or the device has moved beyond the stationaryRadius, State #2 is engaged. Otherwise, the module will simply return the current stationary-location.
  • State #4 is very new. It was paid for and implemented for a single customer with specific requirements.
  • State 4 will have a serious impact on battery-life, since your app is prevented from sleeping and the accelerometer will be constantly firing up location services when movement is detected.

from react-native-background-geolocation.

normanrz avatar normanrz commented on August 23, 2024

I understand. Thanks for taking the time to explain!

from react-native-background-geolocation.

kholiavko-roman avatar kholiavko-roman commented on August 23, 2024

@christocracy, can you tell me please, on ios update by time is absent ?
I want to set up update by distance and by time at one time, if its possible.

from react-native-background-geolocation.

christocracy avatar christocracy commented on August 23, 2024

iOS location API is strictly distance-based (ie: distanceFilter)

from react-native-background-geolocation.

kholiavko-roman avatar kholiavko-roman commented on August 23, 2024

Thank you!

from react-native-background-geolocation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.