I want to bring another app to front if it is running already, otherwise I don't want to do anything.
Normally I start the other app like following:
ComponentName compName = new ComponentName(packageName, activityName);
Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
i.setComponent(compName);
context.startActivity(i);
If I remove the Intent.FLAG_ACTIVITY_NEW_TASK
the call will throw an exception that indicates, that it is not allowed to start the activity without this flag from a non activity context...
Can I somehow else do what I want?