I have developed an application in PhoneGap that is tracking your traveled route through geolocation API, I am getting the current position of the device through navigator.geolocation.getCurrentPosition(onSuccess, onError); and updating the polyline by getting the position after regular intervals through navigator.geolocation.watchPosition(function(position)
But now the problem is it's not working in background i.e (when I open another application and it starts running in background ) it doesn't update the polyline mean not triggering this navigator.geolocation.watchPosition(function(position) function so I tried to run the app through Cordova-plugin-background-mode this plugin its start running the app in the background and again that wasn't triggering the navigator.geolocation.watchPosition(function(position) function means this wasn't required i.e (there wasn't any need to install the plugin to run the app in background mode). So please help me to solve this problem of getting the position in background mode. And if I use this Cordova-plugin-mauron85-background-geolocation plugin how I can get a position as I was getting through watch position? and what to do if the app is running in the foreground? do I have to use the watchPosition function or something else?