According to my previous post, and some research online, I found out that the sytem might be playing the music even after the service's onDestroy was called because it was holding on to some resources like the MediaPlayer
, so I decided to actually kill the process instead of calling the stopForeground
or stopSelf
, because they simply are not working. However, I synced all the application states and called System.exit(0)
and it kills the foreground process as well as the activity as intended.
The only bit of confusion I had if System.exit(0)
killed the process and also freed the app resources? That is, does it release every bit of resource held by the app? I am worried about it because I don't need to call MediaPlayer.release()
and stopForeground()
and other similar cleanup methods, just one System.exit()
does the trick.
It's okay to call this for my app, because it triggers the behaviour I intend, but, I wonder if its okay for the android system, because lingering memories would be a bad thing. Thanks in advance, any insight would be helpful.