I know that Activities can be declared in manifest as being excluded from recents with android:excludeFromRecents:
http://developer.android.com/guide/topics/manifest/activity-element.html#exclude
However, that’s not what I’m looking for, I would like to know if there is a way to remove the app from recent apps programmatically
Yes, generally when you want to have special properties for an
Activitywhen starting it you supply special flags to theIntent. In this caseFLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.Updated:
If you need to hide the current already running activity, you might be able to use this flag in combination with
FLAG_ACTIVITY_CLEAR_TOPwhich would send the new Intent to the existingActivity. You’ll have to think and perhaps experiment with what happens as the user moves around your stack though and whether that will make your app re-appear in the recent apps.