Frequently Asked Questions
Can I use Task Invoker to make sure a web request finishes even if the app goes to the background?
Yes you can start all of your web requests using the Task Invoker when the app is in the foreground and that ensures that the app will be kept alive in the background until they have finished. You can find an example of this in the documentation. Note that the app can still be killed by the user or the OS.
Can I use Task Invoker to access gps location while my app is in the background?
You can read the last updated location data from the Unity location API but the data will not update while the app is in the background. To access the location in the background you would need to implement your own native location solution. Note that there are strict restrictions set by the OS about background location usage.
Can I use Task Invoker to make a web request periodically?
You can make a web request when the app goes into background and Task Invoker will keep the app running until it is complete. However, Task Invoker is not suited for making a request every x hours or similar.
Can I use Task Invoker to play audio in the background?
No. You would need to implement your own solution to control the audio focus on Android and implement the audio background mode on iOS. Playing Unity AudioSources in the background with Task Invoker will only take effect once the app returns to the foreground.
Can I use Task Invoker to keep a multiplayer connection alive?
Most multiplayer solutions on the market disconnect the user when the app is sent to the background on mobile. The Task Invoker is not suitable for preventing this.