How do you properly exit an app?

Hi all, hope everyone is well!

I have created an (android) app that interacts with an ESP32 via 2 methods. First, the app can connect to the ESP32 via the ESP32's built-in bluetooth hardware and software. Second way the app connects to the ESP32 is via SMS messaging. The ESP32 is connected to a cellular module and can receive and send SMS messages. This all working good, but

When I build an .apk file for my app and install it on my android phone, it works. Bluetooth and SMS communication works great. However, when I close the app, it still receives SMS messages. To stop the app from receiving SMS messages, I have to put the app to 'sleep'.

So, ideally, I'm looking for a way to put the app the sleep on exit from the app. There is a 'screen.initialize' block that allows me to define variables and start events, but I'm not seeing anyway to end those events when the app is closed, or to detect that the app was closed.

How do I shut down all events and timers on my app when the user closes the app?

Thanks for any help,
Randy

Timers: Set enabled to false
BlueTooth: Use the Disconnect Block
Exit App: Close Application Block

ExitApp