If I have a foreground service running which spawns a thread, can that child thread ever be killed by the Android OS? Or is that child thread protected as well just like the Service? To prevent the child thread from being killed, do I need to make it into its own Service?
Thanks,
Nick
Your service is a component. You indicate that it is a “foreground service”, indicating that you called
startForeground(). So long as you do not stop it, the foreground service will tend to keep the process — and its threads by extension — free from termination, though this is not a guarantee.Android never terminates threads that you fork, except by terminating the entire process.