I have a broadcast receiver triggered by an emergency event that checks if the application is working (user is inactive). Now I would like to reset the activity stack and bring the application to the first activity by default.
But if I do something like this:
Intent intent = new Intent(context, StartUp.class); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_FROM_BACKGROUND | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);
then my application comes to the fore.
I would like to do this quietly so that the user is not disturbed by my application (as he is doing something else).
So my question is how to clear the activity stack without starting the activity?
Drejc source share