0

I have an app, that has several activities and one of them is acting like “reminder popup style” activity. This activity defined as NEW_TASK and is launched from service. But the problem is when this activity shows up, it always brings to front the previous stack from my app, even if some other app was already in foreground.

Please see the diagram below:

enter image description here

The behaviour I want to achieve is when Popup Activity is being closed bring to front the "Some Other App" if it was in foreground before the Popup Activity showed up. Currently always the Activity C of "My App stack 1" is coming to front.

Artyom Okun
  • 939
  • 1
  • 8
  • 14

2 Answers2

0

if you want to make "some other app stack 1" in foreground then you should call that popup from "some other app stack 1"'s activity c... here u always call the popup from "my app stack 1"'s activity c.. so if u always wanna show "some other app stack 1"'s activity c as foreground then call the activity from "my app stack 1"'s activity c and first of all show the popup.... u can check the bit if is 0 then popup show other wise "some other app stack 1"'s activity c's layout...

  • 1. The code is too big to being added here. 2. Although the diagramm shows the arrow from the activityC to PopupActivity, I described that the activityC is being opened from background service. 3. I can not call my popup activity from other app... 4. I don't want ALWAYS show other app, I want to get back to the last app that was in foreground. For now, when PopupAcivity is closed it always goes back to ActivityC of "My App Stack 1". – Artyom Okun May 11 '17 at 14:43
  • yeah but how could you check with app is running because you are already in your app and it is in foreground. so it will always return to that app. because you didn't know all application's package name to redirect dynamically on that app. – Kuldeep Jindani May 12 '17 at 05:50
0

Ok, the solution is to declare the PopupActivity in Manifest as singleTask and call this activity with intent including flag NEW_TASK.

Artyom Okun
  • 939
  • 1
  • 8
  • 14