# Location data not sent to server after I kill the app

**URL:** <https://forum.ionicframework.com/t/location-data-not-sent-to-server-after-i-kill-the-app/207265>\
**Category:** Ionic Angular\
**Created:** [March 27, 2021, 6:49pm UTC](https://forum.ionicframework.com/t/location-data-not-sent-to-server-after-i-kill-the-app/207265 "2021-03-27T18:49:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashfan077](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@ashfan077](https://forum.ionicframework.com/u/ashfan077)\
**Post date:** [March 27, 2021, 6:49pm UTC](https://forum.ionicframework.com/t/location-data-not-sent-to-server-after-i-kill-the-app/207265/1 "2021-03-27T18:49:49Z")

</div>

I’m building a delivery application. I need to track driver location every X seconds when the app minimized it’s working fine but if I kill the app it’s not sending data to the server. below is my code.

```auto
startBackgroundGeolocation() {
const config: BackgroundGeolocationConfig = {
  desiredAccuracy: 1,
  stationaryRadius: 1,
  distanceFilter: 1,
  interval: 10000,
  startOnBoot: true,
  startForeground: true,
  notificationTitle: "Delivery App",
  notificationText: "Test notification text",
  debug: true, // enable this hear sounds for background-geolocation life-cycle.
  stopOnTerminate: false // enable this to clear background location settings when the app terminates
};

this.backgroundGeolocation.configure(config).then(() => {
  this.backgroundGeolocation
    .on(BackgroundGeolocationEvents.location)
    .subscribe((location: BackgroundGeolocationResponse) => {
      console.log(location);
      console.log('Application Lat' + location.latitude);
      console.log('Application Lon' + location.longitude);

      this.geo.Latitude = location.latitude;
      this.geo.Longitude = location.longitude;
      console.log('API Geo Latitude' + this.geo.Latitude);
      console.log('API Geo Longitude' + this.geo.Longitude);

      // alert(location.accuracy);

      this.sendGPS();
    });
});

```

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [March 27, 2021, 6:52pm UTC](https://forum.ionicframework.com/t/location-data-not-sent-to-server-after-i-kill-the-app/207265/2 "2021-03-27T18:52:25Z")

</div>

One again:  
This is the only working Cordova/Capacitor Plugin for Background Geolocation: [https://github.com/transistorsoft/cordova-background-geolocation](https://github.com/transistorsoft/cordova-background-geolocation) - It costs but is worth it. In our team we decide to buy it and it works great 😊

---

<div class="post-metadata">

**Author:** ![ashfan077](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@ashfan077](https://forum.ionicframework.com/u/ashfan077)\
**Post date:** [March 27, 2021, 6:54pm UTC](https://forum.ionicframework.com/t/location-data-not-sent-to-server-after-i-kill-the-app/207265/3 "2021-03-27T18:54:28Z")

</div>

Link not working 404 error

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [March 27, 2021, 7:41pm UTC](https://forum.ionicframework.com/t/location-data-not-sent-to-server-after-i-kill-the-app/207265/4 "2021-03-27T19:41:39Z")

</div>

Sorry i posted the paid access one: [GitHub - transistorsoft/cordova-background-geolocation-lt: The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.](https://github.com/transistorsoft/cordova-background-geolocation-lt)
