when you need to make an app always persistent. This single need is what differentiates modern programming from the way things were done 15 years ago, when an app stayed in memory until the user hit exit. It makes it very hard to write a GPS logger, a stopwatch, or a groundstation.
The world of Intents, Services, IntentServices, Bundles, Binders is still a mystery. Most of the information is hidden on vogella.com, in which every page begins with a picture of some ugly head probably belonging to Vogella himself. His competitor is androidhive.info, on which every page begins with a picture of a guy in need of an attitude adjustment.
It feels like Google went through many ideas, while trying to solve the problem of app persistence. They may have originally allowed apps to stay persistent. The system now no longer makes anything persistent. Many of the structures that used to hint at persistence are no longer meaningful.
Nowadays, there is only 1 way to get persistence. You have to simulate it by setting a system alarm. The system alarm calls onStartCommand in an existing app Service. If the app was terminated, it reinstantiates it with everything set to null again. It's up to the app to detect it was restarted & reload its entire state from flash. Then the onStartCommand called by the alarm needs to set the alarm to call itself again & save its new state to flash.
It's an inefficient, bootstrapping way of keeping an app running. No matter what,
...Continue Reading