I'm new to Android development. After a month looking here and there on Internet I succeeded in developing an app that is able to call a runnable class (ScheduledTests in the code below) every x seconds with:
private var startTests = Executors.newSingleThreadScheduledExecutor()
val st = ScheduledTests()
testProvider = startTests.scheduleAtFixedRate(st, 1, 5, TimeUnit.SECONDS)
The problem is that the runnable is called only if the app is active. If I active another app or if the phone goes stand by the function isn't called anymore.
I guess I have to configure a service but I don't know how. Is there a document with examples I can read?