Reanbling background geolocation.
This commit is contained in:
parent
a8da543228
commit
f7b59e5ead
|
@ -43,7 +43,7 @@ const GPXOverlay: React.FC<{
|
||||||
>
|
>
|
||||||
<polyline
|
<polyline
|
||||||
points={trkToPolyline(props.track)}
|
points={trkToPolyline(props.track)}
|
||||||
stroke="black" stroke-width="3" fill="none"
|
stroke="black" strokeWidth="3" fill="none"
|
||||||
></polyline>
|
></polyline>
|
||||||
</svg>
|
</svg>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -38,7 +38,6 @@ const LiveMap: react.FC = () => {
|
||||||
|
|
||||||
let [track, setTrack] = useState(emptyTrack);
|
let [track, setTrack] = useState(emptyTrack);
|
||||||
|
|
||||||
/*
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('com.dyomedea.dyomedea LOG', ' - Adding the watcher');
|
console.log('com.dyomedea.dyomedea LOG', ' - Adding the watcher');
|
||||||
BackgroundGeolocation.addWatcher(
|
BackgroundGeolocation.addWatcher(
|
||||||
|
@ -99,10 +98,9 @@ const LiveMap: react.FC = () => {
|
||||||
if (location !== undefined) {
|
if (location !== undefined) {
|
||||||
setCenter([location.latitude, location.longitude]);
|
setCenter([location.latitude, location.longitude]);
|
||||||
setPosition([location.latitude, location.longitude]);
|
setPosition([location.latitude, location.longitude]);
|
||||||
track.geometry.coordinates.push([
|
track.trkseg[0].trkpt.push({
|
||||||
location.longitude,
|
$: { lat: location.latitude, lon: location.longitude },
|
||||||
location.latitude,
|
});
|
||||||
]);
|
|
||||||
setTrack(track);
|
setTrack(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,16 +115,15 @@ const LiveMap: react.FC = () => {
|
||||||
// When a watcher is no longer needed, it should be removed by calling
|
// When a watcher is no longer needed, it should be removed by calling
|
||||||
// 'removeWatcher' with an object containing its ID.
|
// 'removeWatcher' with an object containing its ID.
|
||||||
console.log('com.dyomedea.dyomedea LOG', ' - Watcher added');
|
console.log('com.dyomedea.dyomedea LOG', ' - Watcher added');
|
||||||
/ *BackgroundGeolocation.removeWatcher({
|
/*BackgroundGeolocation.removeWatcher({
|
||||||
id: watcher_id,
|
id: watcher_id,
|
||||||
}); * /
|
}); */
|
||||||
})
|
})
|
||||||
.catch((reason) => {
|
.catch((reason) => {
|
||||||
console.error('com.dyomedea.dyomedea LOG', ' - reason: ', reason);
|
console.error('com.dyomedea.dyomedea LOG', ' - reason: ', reason);
|
||||||
});
|
});
|
||||||
}, [track]);
|
}, [track]);
|
||||||
|
|
||||||
*/
|
|
||||||
return (
|
return (
|
||||||
<Map
|
<Map
|
||||||
center={center}
|
center={center}
|
||||||
|
@ -138,7 +135,7 @@ const LiveMap: react.FC = () => {
|
||||||
animate={true}
|
animate={true}
|
||||||
>
|
>
|
||||||
<ZoomControl />
|
<ZoomControl />
|
||||||
<Marker width={20} anchor={center} />
|
<Marker width={20} anchor={position} />
|
||||||
<GPXOverlay
|
<GPXOverlay
|
||||||
mapState={undefined}
|
mapState={undefined}
|
||||||
latLngToPixel={undefined}
|
latLngToPixel={undefined}
|
||||||
|
|
Loading…
Reference in New Issue