RichardMaher / Brotkrumen

Javascript Background Geolocation POC
73 stars 14 forks source link

Trigger readings only upon geolocation change instead of time interval #3

Open RichardMaher opened 5 years ago

RichardMaher commented 5 years ago

@blairmacintyre You mean like the flexible GPS throttle and sanity check options detailed in RegisterServiceWorker

// Register for Background Geolocation tracking. Take default for accuracy, max age.
navigator.serviceWorker.ready
.then(reg => {
reg.travelManager.subscribe({
minSilence: 5, // Car trip value. Collapse GPS.
maxSilence: 600, // Sanity check. Squelch off.
minProgress: 50, // Indoor accuracy an issue.
maxSnail: 55, // Brisk walk.
dropDodgy: true // Avoid wireless Pong.
})
.then(subscription => {travelSubscription = subscription}, locFail)
.catch(err => {
console.log('Travel Manager Subscription failed with ' + err);
reportError({header:"Could not subscribe to Travel Manager",
message:err});
});
});
}