Good evening! I need to create an app which will always return after user minimizes it (like by clicking HOME button). I think I will have to add a Service with Timer, which will check if the Activity is Visible or invisible at the moment and return to app if invisible
if(!App.isActivityVisible()){
Intent intent = App.getCurrentIntent();
if(intent != null){
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
But app creates a new activity, but I want to get the old activity...
But I think there is a simpler solution...
EDIT
So, I get the old activity, but when I pressed button back - my app finish, but I want to get previous activity.
I use
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
EDIT
Yes, I found solution
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);