Open lane4-wiz opened 2 weeks ago
Does heartbeat accuracy increase when the scheduleUseAlarmManager option is specified?
@christocracy Please check.
Does heartbeat accuracy increase when the scheduleUseAlarmManager option is specified?
No
@christocracy So, is there a way to periodically receive location information?
is there a way to periodically receive location information?
Yes, that's what react-native-background-fetch
is for (already included as a dependency). See its README.
In your BackgroundFetch
callback function
, you're free to do anything you want, including BackgroundGeolocaiton.getCurrentPosition(options)
.
You'll never get a location "every minutes" while the device is stationary.
@christocracy but is it possible - Location updates occur every two minutes?
While stationary, the best you’ll get is every 15 minutes, using background-fetch
Your Environment
react-native -v
): 0.72.6heartbeatInterval: 60,
BackgroundGeolocation.onHeartbeat(event => { console.log('[onHeartbeat] ', dayjs().format('YYYY-MM-DD HH:mm:ss'), event); BackgroundGeolocation.getCurrentPosition({ timeout: 30, maximumAge: 5000, samples: 1, }).then(location => { console.log('[getCurrentPosition] ', location); }); }),