ExcludeFromRecents not working with taskAffinity

Possible duplicate : How not to show the application in the list of recent applications in ICS? excludeFromRecents not working

Let's say I have two activities A (main action) and B. I start B with A as follows:

Intent i = new Intent(A.this, B.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); 

I want my application to have only one regent entry at any time, and B for a new task. If B has a manifest entry as follows, I achieve this:

  <activity android:name="com.example.verysimpleactivity2.app.B" android:excludeFromRecents="true" android:label="B" ></activity> 

But I also want B to have a different task, and not the main activity, i.e. A. Therefore, I modify the manifest entry as follows:

  <activity android:name="com.example.verysimpleactivity2.app.B" android:excludeFromRecents="true" android:taskAffinity="" android:label="B" ></activity> 

In this case, if B is not in the foreground, then it does not appear in repetitions, and I only have A (good!). However, if B is in the foreground and I press the recents button, I see both A and B there. Why is B shown in these cases in this case? How to make sure I don’t see B at all?

+6
source share
2 answers

It seems impossible to achieve what I want (at least in KitKat).

Source: Android engineer

+1
source

A bit late, but also adds an answer from androidManifest activity android: excludeFromRecents . Just in case, someone had the same problem, and although it did not work.

0
source

All Articles