I have to download a large amount of data from the server and continue doing it in the background even when the user hides my app (sample: when you install a app from Play Market, you can switch to another app and loading continues) in my iOS nativescript-angular application. How can I do this? Can I use Angular Services for it?
Advertisement
Answer
As a suggestion on this.A Worker is different from Background Service. A work just helps you to move your load from main / UI thread into a different thread. But you need a Background Service when you want to fetch location & upload data in background even when your app is minimised / killed.
nativescript-geolocation plugin itself has an example for fetching location in background, you may use the similar approach and upload data to server instead of showing it in a toast as in the example.
For iOS, you should use the geo location plugin and subscribe for updates in background using Background Fetch. Instead of UIBackgroundModes
as fetch
you should use location
.