I have an app that does a task every minute and then adds that info to an ArrayList stored in the MainActivity of the app. While the app is running, even in the background, this works perfectly. However when I destroy the app and let the AlarmManager repeat every minute in the background, for some reason the list is wiped each time new info is added, meaning that the next time I open the app there is always only one object in the ArrayList, which was the last one created by the last AlarmManager that went off.
This event every minute is handled in a BroadcastReceiver which calls a method in the main activity to add to the arraylist stored there. Could this possibly be why my data is wiped whenever the app isn't running? Each time I want to add new data to the list, I have the app fetch the current list from storage, which fetches the list correctly until the app isn't running, then it fetches an empty list each time.