I know it should be achievable be either android:excludeFromRecents="true"
in android manifest or Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
Intent flag.
Problem is, that doesn't work if application is currently being shown - when Recent Apps button is clicked, application is always shown in the first place, allowing for quick killing of the application (by swiping it). Not good for an alarm clock app.
Music Service keeps on playing fortunately and user can get back to finishing alarm by the notification, but I have really hard time recreating activities stack.
Any quick fix available?
Large thumbnails of recently used apps display with each app's icon. To remove an app from the list, hold your finger down on the thumbnail for the app you want to remove until a popup menu displays. Touch “Remove from list” on that menu.
The Recents screen (also referred to as the Overview screen, recent task list, or recent apps) is a system-level UI that lists recently accessed activities and tasks. The user can navigate through the list and select a task to resume, or the user can remove a task from the list by swiping it away.
This is a well known Android Issue: https://code.google.com/archive/p/android-developer-preview/issues/1662
This is a solution:
ActivityManager am =(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); if(am != null) { List<ActivityManager.AppTask> tasks = am.getAppTasks(); if (tasks != null && tasks.size() > 0) { tasks.get(0).setExcludeFromRecents(true); } }
If Task Root Activity is excluded from recent, all activities in this task will be excluded too.
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