Monday, December 4, 2017

How to check backgroundGeolocation started or not in phonegap

Leave a Comment

I am creating a log file, and then saving the coordinates when app run in background through backgroundGeolocation. The problem is when app runs in background mode then it's not saving the coords in log file, actually I am doing this for testing purposes that does this plugin working fine or not.

document.addEventListener("deviceready",onDeviceReady,false);       // PhoneGap is ready to be used!       //       function onDeviceReady() {     window.logToFile.setLogfilePath('/myapp/log.txt', function () {           backgroundGeolocation.configure(callbackFn, failureFn, {           desiredAccuracy: 10,           stationaryRadius: 20,           distanceFilter: 30,           interval: 60000       });       backgroundGeolocation.start();     }, function (err) {         // logfile could not be written          // handle error      });       var callbackFn = function(location) {        window.logToFile.debug('[js] BackgroundGeolocation callback:  ' + location.latitude + ',' + location.longitude);       backgroundGeolocation.finish();   };    var failureFn = function(error) {       console.log('BackgroundGeolocation error');   };             } 

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment