I created an android application with a logout option in onCreateOptionsMenu. The Logout works perfectly but when I press the back button again it takes me to t
For Xamarin Users:
int pid = Android.OS.Process.MyPid();
Android.OS.Process.KillProcess(pid);
put it in your OnDestroy() function.
Edit:
After investigating it thoroughly, I found out that even the above code I wrote does not "Kill" the app totally (deleting it from task manager - "recent apps"). Eventually, after a lot of code tryouts, I managed to figure something out, Overriding "Finish" functions with this code:
public override void Finish()
{
if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
base.FinishAndRemoveTask();
}
else
{
base.Finish();
}
}
this is the sole solution for that question!