Issue
I am working on a legacy project. This Android app was a system app installed in a specific tablet model with a customized Android operative system. The user only had access to this app, he couldn't access any other features of the tablet. So only this app was on the screen.
Now, the customer want to open the app to smartphones and I'm doing this update. I realized that when I close the app manually (swiping up from open apps screen) the process is still alive. I can see this running ps -A | grep myAppName
command in the shell, even after several minutes. I tried with other apps and the processes disappeared when the apps are closed.
In the onDestroy
method of the MainActivity
(the launcher activity) I do these things:
- Stop all services with
stopService(new Intent(this, MyService.class));
. - Stop some
Timer
objects.
I don't know what other components can keep the app active. The app has BroadcastReceiver
s and a LifecycleObserver
but I don't know if some of them could be the reason. I know that Android keeps in memory the apps and kills them when it is necessary, but I think that this example is not that case. Do you have any ideas on this?
Solution
how about add this code in your onDestroy function?
System.exit(0);
Answered By - S T
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.