I'm launching a MainActivty
from a BroadcastReceiver
when Android starts:
Intent miIntent = new Intent(this, MainActivity.class);
miIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(miIntent);
This works fine; the MainActivity
is launched. The problem is when I press the home button on MainActivity
and then I open the application again. It doesn't resume the app, but instead it creates a new Activty. If I press a button finish (the MainActivity contains a button to finish()) MainActivity appears again, because the last doesn't close. Help me please, I dont know what to do.
I think the problem is in the flags, because if I open the app again, it works fine (without booting from broadcastreceiver).
Thanks!!