I have this code where I save data in firebase
let options = {
frequency: 3000,
enableHighAccuracy: true
};
let markes = [];
this.watch = this.geolocation.watchPosition(options).filter((p: any) => p.code === undefined)
.subscribe((position: Geoposition) => {
markes.push({
latitud:position.coords.latitude,
longitud:position.coords.longitude
});
this.actuario.set({markes}, { merge: true })
.then(function() {})
.catch(function(error) {
console.log("Error al subir datos! " + error);
});
});
The idea is to save the data every 5 minutes, is there any way to impliment this idea? I've tried with settimeout, setInterval but it does not work for me