I had one and the same problem, I had to select lat, lng every few minutes and calculate the distance, but only one plug-in could not solve it, because it stops working when the phone falls asleep .. so I had to make sure that the phone did not fall asleep ..
So, I used the power management plugin along with the background plugin .. and it works well.
Background Mode Plugin: https://github.com/katzer/cordova-plugin-background-mode
Power Management Plugin https://github.com/boltex/cordova-plugin-powermanagement
if( ionic.Platform.isAndroid() ){ cordova.plugins.backgroundMode.enable(); window.powerManagement.dim(function() { console.log('Wakelock acquired'); }, function() { console.log('Failed to acquire wakelock'); }); window.powerManagement.setReleaseOnPause(false, function() { console.log('setReleaseOnPause successfully'); }, function() { console.log('Failed to set'); }); }
source share