Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70924

Background Geolocation Functions problem

$
0
0

@inartech wrote:

Hello guys,

I installed and configured background geolocation plugin (
https://github.com/mauron85/cordova-plugin-background-geolocation ) 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)=>{
    this.globals.lat = location.latitude;
    this.globals.lng = location.longitude;
    this.storage.set('lat',location.latitude);
    this.storage.set('lng',location.longitude);
}, (error) => {
    alert(error);
});

this.backgroundGeolocation.start();

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???

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70924

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>