I have MainActivity declared with following HOME, DEFAULT category, and MAIN Action. I also do select the app as default launcher. When I click back press it closes MainActivity as expected. But if I leave MainActivity running and restart the device, I cannot get out of MainActivity! Pressing onBackPress() in which I call finish(), pauses the activity as expected. But then I see onCreate called(), onResume() and MainActivity is back up like a clown! What I can do? This only happens after restart of device when activity is left running.
I'm doing everything I can to get rid of this activity including inside
onBackPressed(){
ActivityCompat.finishAffinity(MainActivity.this);
finish();
}
I have seen suggestion to FLAG_ACTIVITY_CLEAR_TOP but its the OS that starts the Activity in the first place, not me.
I cannot leave the app at all!