Scenario - I dont have my application running in the background. I have a receiver implemented for ACTION_USER_PRESENT. In this receiver i start a activity whose manifest settings are :
<activity android:name=".activity.MyActivityB"
android:excludeFromRecents="true"
android:noHistory="true"
android:screenOrientation="portrait"/>
This is because there is banner in it for which i credit points to the user and i dont want the user to be able to launch it again and again for the same banner .
I finish the activity on pause because I want to close it as soon the user navigates away from it.
But using a Nexus device, when I press the recents button then the activity is shown in the recents and on again pressing it the activity is recreated .
but what should happen is When the activity was in the foreground and i press recents button , then the activity should finish because i had called this :
@Override
protected void onPause() {
System.out.println("MyActivityB onpause called ");
super.onPause();
bannerShown = false;
if(!isFinishing())
finish();
}
But the activity doesnot gets finished probably and recreated when i again press the recents button.
this is not in the samsung devices but only in the Nexus devices with Android 6 & 7 that have recent apps button (i.e the square one).