Updating location data into the server is not working using background geo locaion in ionic 3

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',
    httpHeaders: {
      'Content-Type': 'application/json'
    postTemplate: {
      lat: '@latitude',
      lon: '@longitude',
      user_id: '1',
      currentDate: '12-12-2019',
      address: 'test',

  .then(() => {

    this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location: BackgroundGeolocationResponse) => {



Background geo location post template

Keep in mind that all locations (even a single one) will be sent as an array of object(s), when postTemplate is jsonObject and array of array(s) for jsonArray!

In server-side, I changed the JSON object to an array of object.

For example,

{ "user_id": "1", "lon": "13.2", "lat": "82.3" }

I changed the above JSON object to following

[{ "user_id": "1", "lon": "13.2", "lat": "82.3" }]

const config: BackgroundGeolocationConfig = {

  locationProvider: 1, 

  desiredAccuracy: 0, 

  stationaryRadius: 0,

  distanceFilter: 0,

  notificationTitle: 'Tracking position in the background',

  notificationText: 'enabled',

  debug: false, 

  interval: 5000,

  fastestInterval: 1000,

  activitiesInterval: 1000,

  stopOnTerminate: false, 

  startOnBoot: true,    

  startForeground: true,

  pauseLocationUpdates: false,

  stopOnStillActivity: false,

  saveBatteryOnBackground: false,

  url: 'http://srmtcvizag.com:4444/nodeapp/updateaddresslatlon',

  // customize post properties

  postTemplate: {

    lat: '@latitude',

    lang: '@longitude'



  // enable this to clear background location settings when the app terminates


This method was not posting any data