How can save my locations using Background Geolocation to print map with points

Hello,everyone .
Hello,everyone .

I want to tracking the user app even Background mode.

I’ve followed this tutorial :

And I’ve modified some things like :

1.Create model to save locations
2. I’ve add the location to my array inside : this.zone.run , like this :

this.zone.run(() => {
this.lat = location.latitude;
this.lng = location.longitude;
console.log(“ZONE 1”);
let newLocation: location = {
lat: location.latitude,
lng: location.longitude
};
this.locations.push(newLocation);
});

  1. When user click on Stop Tracking, i want to print with alert all locations tracked.

I am not sure if I should added the locations inside this.zone.run , i’ve tried put that outside(before of this.zone.run but it fails too)

Any idea about that ?

My code project is :

I would like to integrate thr project using this tutorial too: