Comments (13)
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.
I know, I am more concerned about the interval that the data is sent to the server.
from react-native-background-geolocation.
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.
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.
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.
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.
And when the user is sitting in a movie theatre for 2 hours, for example, what are your expectations?
from react-native-background-geolocation.
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.
Regarding iOS specifically, this module has 4 possible states:
- Stationary:. App is suspended. No code is running. No tracking.
- Moving: App is awake and actively recording a location each
distanceFilter
meters. - 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. IfstopTimeout
expires, the module switches to State 1 or State 4 (ifpreventSuspend: 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. - 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 at1Hz
. If any movement as all is detected after aheartbeatInterval
, 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 thestationaryRadius
, 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.
I understand. Thanks for taking the time to explain!
from react-native-background-geolocation.
@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.
iOS location API is strictly distance-based (ie: distanceFilter
)
from react-native-background-geolocation.
Thank you!
from react-native-background-geolocation.
Related Issues (20)
- Problem in handling permissions using onProviderChange. Two scenarios I am facing the issue
- `- BackgroundGeolocation is configured and ready` never logs true in the example code HOT 7
- User Arrow Direction on Android Often Misrepresents Users Walking/Facing Direction HOT 1
- Can not debug on android HOT 7
- Could not find any matches for com.transistorsoft:tslocationmanager-v21:+ as no versions of com.transistorsoft:tslocationmanager-v21 are available. HOT 11
- Do I need to buy the source code of this TSLocationManager? HOT 1
- How to use the TSLocationManager static library? HOT 1
- Background location didn't respond if I stops for certain minutes and then moving again HOT 5
- Discussion: Time-based Tracking and backgrounded app HOT 1
- LocationRequestService ANR on Android 14 HOT 10
- License Validation Issue After Upgrading React Native and react-native-background-geolocation (Android Only) HOT 3
- Battery Drain Issue (IOS) HOT 5
- Enter/exit geofence is not detected in trackingMode Geofences only (iOS) HOT 7
- Why is event optional?
- How do I initially (before reaching 200m) record positions accurately? HOT 1
- Continuous Location Tracking in Background for Android and iOS HOT 11
- Upgrading the plugin version failed on Android.
- Location Tracking Persists After Stopping in react-native-background-geolocation HOT 2
- Need to send the data simultaneously but it not sending the data every ten seconds once HOT 2
- We can't insert any coordinates in the server when the app is terminated (ANDROID) HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-background-geolocation.