Ionic 4: I would like to pull User’s geolocation and send a POST request to the server when the app is in the background, foreground or even when it is terminated.
There is this module, https://ionicframework.com/docs/native/background-geolocation, which does not work. Hence I would like to use Background mode (https://ionicframework.com/docs/native/background-mode) if it works and keep pulling the location in the background after a certain interval.
I’m thinking to use the background mode and use a sleep function in the background to pull the location. I’m afraid the app may get closed by the Android system if it runs too much time in the background. And the sleep function may not be the best way to achieve this.
What is the best way to achieve my intent?