Will Android kill public class App extends Application
if there is a foreground service running?
I am not sure if it's even important... If I have a reference from that service to a object instantiated in Activity or App and that Activity/App gets killed, will reference from the service still be valid?
Last question is... What happens with static fields if app associated with the class containing the static fields gets killed?
Will Android kill public class App extends Application if there is a foreground service running?
Classes are not "killed" in Android. Processes are terminated. An Application
instance is created when your process is created, and it remains around until the process is terminated.
So long as the foreground service is running, it's process is alive (by definition), and its Application
will remain around.
What happens with static fields if app associated with the class containing the static fields gets killed?
Again, classes are not "killed" in Android. Processes are terminated. When your process is terminated, everything in memory goes away, including static
fields and their references.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With