I am using Background geo location. It gives location details in the foreground and gives debug messages when the app is closed but it does not update the location details into the server both foreground and background.
Thanks in advance
const config: BackgroundGeolocationConfig = {
desiredAccuracy: 10,
stationaryRadius: 10,
distanceFilter: 10,
debug: false,
stopOnTerminate: false,
startForeground: true,
notificationTitle: 'location tracking',
notificationText: 'Active',
interval: 60000,
url: localStorage.getItem('api_base_url')+'user/currentlocation',
syncUrl:localStorage.getItem('api_base_url')+'user/currentlocation',
httpHeaders: {
'Content-Type': 'application/json'
},
postTemplate: {
lat: '@latitude',
lon: '@longitude',
user_id: '1',
currentDate: '12-12-2019',
address: 'test',
}
};
this.backgroundGeolocation.configure(config)
.then(() => {
this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location: BackgroundGeolocationResponse) => {
console.log(location);
});
});
this.backgroundGeolocation.start();