If the problem is that your app is destroyed by android when in backgroud, the standard way to do would be to save data in the onDestroy() function of your main activity, and retrieve this data in the onCreate method when to app is opened again ( using the bundle).
If you want the data to persist even when the phone is turned off, you can considere permanent storage options like a database. Have a look at http://developer.android.com/guide/topics/data/data-storage.html
Finally, if you would like a way to keep running in background, you could have a look at the Service class. But if would demand some more coding from you to be able to communicate between your service and the activity