title: How to execute code when Home button is pressed?
body: <p>I want to run code only when the home button (when the app is sent to background) is pressed. I tried using the lifecycle-method but the problem is that they also get executed when and other dialog/activity is started. I only want to check if the application is sent to background. How can I achieve that?</p>