-4

My Android app sends the user off to a URL. How do I exit an app and remove it from being a recent view completely after starting webbrowser? If the user then goes and clicks on the app to run it again, there is a crash because it was started while another instance was still running in the background and it doesn't seem possible to get it terminated because of the act of opening the browser.

Aneel Pandey
  • 31
  • 1
  • 6

1 Answers1

1

In api 16, you can use this.finishAffinity();

In api 21 or later, you can use finishAndRemoveTask();

You can learn more here.

Adam Medina
  • 109
  • 8