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 .
From this activity i launch another activity on some button press. This new Activity MyNewActivity is launched with this :
Intent intent = new Intent(MyActivityB.this, MyNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
Intent closeintent = new Intent("MAIN_ACTIVITY_CLOSE");
closeintent.putExtra("action", "close");
LocalBroadcastManager.getInstance(this).sendBroadcast(closeintent);
MyActivityB.this.finish();
Now my new activity should appear in the recents if I long press home button or the recents button .
But the problem is , when i press home MyNewActivity is not being shown in the recents.
The MyNewActivity is defined in Manifest like this :
<activity
android:name=".activity.MyNewActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" />
what am i doing wrong and why not MyNewActivity is appearing in the recents.