hecho una muy buena pregunta que trato de resolver por mi cuenta.
Incluso me pregunto ¿Cuál es la diferencia entre matar una aplicación y reiniciar el teléfono.
Si un usuario mata manualmente una aplicación o abre otras 20, probablemente quiera que la aplicación comience desde el principio. ¿Por qué Android no restablece el estado después de reiniciar el teléfono?
Además, veo que cuando una aplicación es eliminada (por el sistema), las variables globales se vuelven nulas cuando se reinicia la actividad. Este tipo de rompe el concepto de Java. Si tiene algún tipo de estado en la aplicación y la aplicación lo borra, esperaría que la aplicación se reinicie.
La solución que propongo:
1. Handle the case of a state problem: Initiate a simple state (new Object()) as a global variable. For each Activity, in the methods onCreate/Start/Resume check that the state is null. If it's null launch the first activity with 'Intent.FLAG_ACTIVITY_CLEAR_TOP' - as if the application is relaunched.
2. Try not to use global variables - Always put data in the intent.
3. Lazy load global variables - If you do want to use global data, don't count on one time initialization. Lazy load them 'if (A.MY_DATA == null) {A.MY_DATA = new ...}' - Don't forget to do it in the background if it will take a long time (AsyncTask). Loading partial state needs to be done carefully because it may not comply to other loaded state objects.
La desventaja del primer punto es que el manejo problema de Estado que hay que hacer en cada actividad (AOP todavía no está implementado en Android).
Espero que haya ayudado.
+1 para una buena pregunta. ¿Podría también publicar su rastro de pila? –