Activity does not appear in registries when the application is in the background

Description of the problem

In one of my applications, I see a rather strange behavior: when my application runs in the foreground (the topmost), I can see its actions in the Recents system. But as soon as I put it in the background, the same action (i.e. AccountsActivity ), which was listed a few moments ago, is no longer present in Recents. Related part of my manifest file:

 <application android:name=".WebnetApplication" android:allowBackup="false" android:allowClearUserData="true" android:hardwareAccelerated="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".StartActivity" android:alwaysRetainTaskState="true" android:excludeFromRecents="true" android:label="@string/app_name" android:theme="@android:style/Theme.NoDisplay" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".AccountsActivity" android:excludeFromRecents="false" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" /> ... 

conclusions

Since this is the only application that changes incorrectly, I checked all the styles and my WebnetActivity and WebnetApplication so that I did not call anything that could affect Recents. Nothing like this.

Then I started to delimit the manifest file to see if something changes. And, as expected, the offender is hiding there, but for me this is not entirely clear. When launched, the AccountsActivity entry in the manifest did not have an android:excludeFromRecents entry at all - this led to the fact that the AccountsActivity was not visible at all in Recents. When I added android:excludeFromRecents="true" , then the activity will become visible in Recents, but only when it was in front. When I went to the back, he disappeared from the respondents. When I remove android:excludeFromRecents="true" from the StartActivity , then AccountsActivity becomes visible in Recents regardless of whether the application is in front or in the background, and I can completely remove android:excludeFromRecents from its record without any problems.

Question

At the moment, I am leaning towards my head, trying to understand why all this behaves like this - is it normal (and I don’t know something), or is this, perhaps, a mistake within the framework? Has anyone encountered a similar problem and can share experience, ideas or explanation?

+7
android android-manifest android-recents
source share
1 answer

Remove android:excludeFromRecents="true" from the main action.

Quote from android: excludeFromRecents :

Whether to exclude the task initiated by this action from the list of recently used applications ("recent applications"). That is, when this action is the root activity of a new task, this attribute determines whether the task should not appear in the list of recent Programs. Set to true if the task should be excluded from the list; set to false if it should be enabled. The default value is false.

+9
source share

All Articles