Nativescript-Angular App - Geolocation while app is in the background

Hello!

I am building a hybrid-app using nativescript and angular that, among other functionalities, should be able to send information about the current location of the user to a server using the geolocation plugin.

Everything works just fine, but I can’t figure out how to keep it sending the locations (5-15 seconds updates) when the users (which will be mainly drivers) take the whole application to the background (to enter a music app for example).

I have tried a lot of different things, but I can’t seem to figure out what I am looking for. More precisely, I don’t know if the options I found solve the aforementioned problem or if they just take the geolocation service and process it in the background (while the app is in the foreground) in order not to interfere with the user interface.

I’d much appreciate if someone could point me in the right direction for both Android and iOS (as in what I should implement so that it works in Android and what to implement so that it works in iOS).

Options I found:
1.

2.
https://docs.nativescript.org/core-concepts/multithreading-model?_ga=2.61764908.1834822381.1567423754-1194537488.1566893752

3.

4.
https://www.nativescript.org/blog/using-android-background-services-in-nativescript (i think this is deprecated because of the implementation of worker option)

5.

Thank you!