Problem with background geolocation plugin functions

Hello guys,

I installed and configured background geolocation plugin ( ) with no problems.

let config: BackgroundGeolocationConfig = {
    desiredAccuracy: 10,
    stationaryRadius: 1,
    distanceFilter: 1, 
    debug: true,
    interval: 2000,
    stopOnTerminate: false,
    url: 'my-link',
    postTemplate: {
        lat: '@latitude',
        lng: '@longitude'
this.backgroundGeolocation.configure(config).then((location: BackgroundGeolocationResponse)=>{ = location.latitude;
    this.globals.lng = location.longitude;'lat',location.latitude);'lng',location.longitude);
}, (error) => {


The coords are saved to server every time the location changes, even if my app is completely closed. The problem is that when there is not internet connection i want to save locations to a local sqlite table and when internet connection returns send this table to server, and I dont know the function-listener of plugin where i have to put my “write to sqlite table” code. The function

BackgroundGeolocation.on('location', function(location) {...});

causes build error with the message that expected 1 argument. Could anyone help me???

After searching deep in the plugin’s files i found the solution, which is far away from the ionic documentation

import {
    BackgroundGeolocation ,
    BackgroundGeolocationConfig ,
    BackgroundGeolocationResponse ,
} from '@ionic-native/background-geolocation';

this.backgroundGeolocation.on(BackgroundGeolocationEvents['location']).subscribe((location) => { 
1 Like