Question

i am launching another application through my application,so i want to check is any instance of that application is already in stack or not? if exist then clear all instance before launch.

Was it helpful?

Solution

Would you be looking for the following flags to add to the Intent you start the other application with:

FLAG_ACTIVITY_CLEAR_TASK

OTHER TIPS

Try adding this flags to your intent

Intent intent= getPackageManager().getLaunchIntentForPackage("com.package.address");

intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top