Hello , I use this plugin from ionic website , it sent location to my server 1 or 2 times when I open the app, but when I close the app it not do anything , is anything wrong with my code ?
start(){
const config: BackgroundGeolocationConfig = {
desiredAccuracy: 10,
stationaryRadius: 20,
distanceFilter: 30,
debug: true,
stopOnTerminate: false,
};
this.backgroundGeolocation.configure(config)
.subscribe((location) => {
console.log(location);
let data = location.latitude+'_'+location.longitude
this.http.get('http://mywebsite.com/index.php/welcome/insertTestData/'+data, {}, {})
.then(data => {
console.log(data.status);
})
.catch(error => {
});
});
this.backgroundGeolocation.start();
}
stop(){
this.backgroundGeolocation.stop();
}