Calling a function every 20 seconds in kotlin
There is a function I'm trying to call every 20 seconds using Timer(). I already tried as well with a while loop followed by a delay of 20 seconds, but ends up running out of memory or throws thread exceptions. How can I do this without making my app crash and run out of memory? For a matter of context, I'm building an app to communicate with a BLE device. I just started with Kotlin, so I'm not sure how to do this without breaking everything.
I just want call the same function because...