I would like to exclude my app from the recent apps list (long press home, multitasking button, etc) BUT only for Android 4.4.1 and 4.4.2. The reason being is that on these Android versions, services can't restart themselves and my service is killed when my app is swiped away from the recents list. Normally it restarts itself without a problem, but it can't do so on 4.4.1 and 4.4.2.
I know you can add android:excludeFromRecents="true" in the manifest but that will exclude it on all Android versions.
I tried what was suggested here but can't get it to work:
Remove app from recent apps programmatically
Any ideas?