How to add location tracking in ionic 3 app where in we can add an interval for location update?

I have been given the task to add location tracking in an ionic 3 app.I have checked cordova geolocation plugin , the watchPosition() method works but there is no option to add an interval such that after an interval of x seconds the location data is obtained.In the plugin the max interval is only 1 second which is default and cannot be changed.Are there any other plugins where interval could be added?

I’ll share the requirements given to me to for more information.

  1. After user logs in we should track their current login location i.e lat/lng
  2. User location should be tracked after every xx mins which is configured in the their profile
  3. If user has no network, location info to be stored locally and sent after they get the network
  4. Tracking should be stopped after a specified time as given in their profile ex: if for a user it could be 8 hours of working, this time is sent when they log in to the app from server
  5. If app is closed stop the tracking
  6. In app closing call an API to inform that app is closed by the user

Can anyone help me with the interval for location tracking and also storing location when there is no network(as in how to detect absence of network connection programatically)?

You can implement it using the setInterval and clearInterval javascript utility and also for the detection of network you can use the plugin which will detect the presence and absence of network programmatically.

Good luck!