Answer the question
In order to leave comments, you need to log in
How to know that an app has been closed from recent apps?
alarmManager fires, alarmActivity starts in receivere. If you close this activity (with the back button, for example), then the application itself will open, the last activity before it (back stack), but if the application was killed from recent apps, then nothing will open. I need to know in onDestroy of this AlarmActivity if the application was killed. If yes, then start MainActivity. Before android 5.0, you can look in activityManager.getRunningTasks, and if there is only one task with one activity, then we start MainActivity. But firstly, since version 5.0, getRunningTasks is considered obsolete, and it is not clear how to do it then, and secondly, something tells me that this is some kind of crooked solution. But I can't find anything. Tell me how to do it right. Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question