This is one of the areas that I really like about Apple, however frustrating it is for developers. There are only a few ways to run (non-finite) code while the app is backgrounded.
Android seems to be taking a page out of iOS's book with the introduction of Android O and its restrictions to background services.
Android seems to be taking a page out of iOS's book with the introduction of Android O and its restrictions to background services.