Hello Arturo
Unfortunately, App Inventor cannot be used to develop apps that can run in the background. MIT have done some work on it, so maybe in the future.
You can run you app in the foreground and use a procedure to keep it running, but the device's battery is probably not going to like it.
There is an extension for App Inventor, but in my tests it failed more often than it worked.
You could try making your app in Android Studio instead. There is a lot to learn but once everything is setup it can be used for practically any app you can imagine.