regisxp
regisxp

Reputation: 986

Starting another application from an Android Application and 'Running Apps'

I have an Android application (let's call AppA) that will use an intent to call another application (AppB), using the method described here :

Launch an application from another application on Android

Using these approach, when I press the back button on AppB I return to the AppA as expected. But, I noticed that, when I navigate to Home screen and then call the 'recent applications' screen, both apps appears there, so, I can reopen each AppA and AppB and use them, independently.

Is there any way to avoid this behavior? In my scenario the user cannot manipulate AppA if AppB was opened from it. So, if the user switched to home when AppB was opened from AppA, when switching back to AppA, the user should see the AppB, since it should be unable to use AppA without closing AppB first.

Thanks.

Upvotes: 0

Views: 647

Answers (2)

hasanghaforian
hasanghaforian

Reputation: 14042

You can remove your Activity from Recent Apps list programmatically. For example see this question:

Remove app from recent apps programmatically

Upvotes: 0

Hoan Nguyen
Hoan Nguyen

Reputation: 18151

Use the FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS flag

Intent i = new Intent(this, AppB);
i.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(i);

Upvotes: 3

Related Questions