Geolocation and send data in the background


#1

So here is what I want to accomplish - being able to periodically send updates to a web service with the current location of the device on which the app is running.
This should happen even if the app is in background, not if the app is terminated.
In Android it works also in background. In iOS the localization is not working in background (it works in foreground).

I’ve tried also to implement an ios AppDelegate and if I press the home button it starts it but the localization is still not working.
I also added the ‘location’ to the UIBackgroundModes and the ‘fetch’ attribute in the info.plist to send the new data to the server with no success.

In the code there is a timer every 30 secs that send new data (from db) to the server and every 2 minutes another one that gets the location (using nativescript-geolocation) and save it in the db; everything works as expected in foreground both platforms but it doesn’t work in iOS in background.

Is there a way to accomplish this or pointing me to some helpful link?
I have found an old post in stackoverflow with a very similar problem but with no answer: https://stackoverflow.com/questions/41695364/nativescript-geolocation-in-the-background