transistorsoft/cordova-background-geolocation-SampleApp

How can we post a mobile latitude and longitude to our server?

Opened this issue · 1 comments

Hi, I have user onLocation event for fetching latest location details storing data into server. But I am not able to store it into Database.

private configureBackgroundGeolocation() {
    BackgroundGeolocation.onLocation(location => {
BackgroundGeolocation.startBackgroundTask().then((taskId) => {
  this.http.get(Constants.url+"admin/storeToken/Locaion"+coords.latitude+"-"+coords.longitude)
      .subscribe(response => {
console.log(response);     
      })
})
    },error => {
    });
    BackgroundGeolocation.ready({
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,  // <-- highest possible accuracy
      distanceFilter: 10,
      stopTimeout:10,
      foregroundService: true,
      stopOnTerminate: false,
      heartbeatInterval: 60,
      autoSync:true,
      autoSyncThreshold: 0,
      debug: true,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE
    }, (state) => {
      if (!state.enabled) {
        BackgroundGeolocation.start();
      }
    });
  }

Please use syntax highlighting. It's engaged by surrounding your code in 3 backticks + optional language:

let foo = "bar";