This is a general question as I don't have enough understanding of the following scenario and unfortunately couldn't find anything on google that explains it.
Let's say I have an app that extends VPN Service, some async tasks, some threads to read and handle the packets being read from the VPN interface. It's understood that once we start the VPN, although we kill the app from the tasks (force-quit), VPN continues to run.
So what happens when we kill the app? Do all the resources (threads, main UI thread) get destroyed?
Similarly, when we restart the app, do all the resources get initialized again?
Can you please explain how it works here.
I have this question because I have a background thread that runs on the main thread. When I force close the app, the thread is not interrupted, but when I try to update the thread after restarting the app (after force quit or killing) I get a null pointer exception as that thread is not accessible. Does the complete UI thread gets reinitialized?
What is the solution to this kind of scenario with VPN service.