Background tasks

Hey.
In Android Studio there is the WorkManager to run tasks in the background. To be precise I want to run a voice recorder in the background that uses some library for wakeword detection and other stuff (like “ok Google”). Is it possible in Processing and if yes are there examples?