I have an activity with launch mode as Single Task.The activity is launched by with intent flags Intent.FLAG_ACTIVITY_NEW_TASK by a Broadcast receiver . If this activity is on top of home screen and if I call moveTasktoBack(true) from this activity, I expect the home screen to be shown however instead of home screen, Activity B from another task is brought in front. The sequence of operations is as follow.
Activity B in TASK B -> [Press Home Button] -> Home Screen -> Launch Activity A by BroadCast Receiver -> Activity A calls moveTaskToBack(true) -> Activity B in Task B comes to foreground.
I have checked the Task Affinity of Task A (with activity A) and Task B (with activity B) and they are different.
How can I make sure that in such a scenario, Home screen is shown when activity moves itself to back of stack.