0

I have my app, and I want it to exit once I switch to something else. example: when I'm in my app and press the home button, the app should exit, and disappear from the background running apps window. how would I do this? maybe in onDestroy?

1
  • This happens for the mobile banking Apps. Isnt it? Commented Jun 2, 2017 at 14:31

2 Answers 2

0

Looks like a duplicate of How to quit android application programmatically. You can try use Activity.onPause method for your purpose, but check some tricky workflows like switching phone off etc.

Sign up to request clarification or add additional context in comments.

1 Comment

still a problem there: when i start the application, it instantly calls onPause
0

Finish the App onPause then the app will not be run in the background.

@Override public void onPause() { super.onPause(); isForeground = false; finish(); } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.