Detect app switch or home key press (or an alternative solution)


I have a setInterval being called on a certain page. The setInterval plays a 1 second sound after every 10 seconds. I used the page lifecycle event function ionViewDidLeave() to clear the setInterval. But how do I clear it when the user switches apps while on the page or presses the home key?
Is there a way to detect an app switch or a home button press?
Or is there a page lifecycle event that triggers when an app is switched?