In which case you did not go through it properly to understand how you make a background/foreground service.
This example may give you some ideas: