I am building an app which should only have a screen with three checkboxes and a button to save the users’ choices about the checkboxes.
In case the user ticks a checkbox and clicks the button, then a certain Service should be started and running even if the app is closed -until the app is started again and the user unticks the checkbox and clicks the button again. Of course, if the user unticks the checkbox, I want that next time the app is started, the checkbox remains unticked, and viceversa.
So my question is, what kind of strategy could I address this? Normal PreferenceActivity? SharedPreferences?
Thanks everybody for the answers in advance 🙂
I used
SharedPreferencesfor something similar to this, simply because it was an easy way to have my Service and Activities see the information.So, just have a RemoteService (http://saigeethamn.blogspot.com/2009/09/android-developer-tutorial-part-9.html) and an Activity.
The Activity starts up and looks at the information, and can start up the service. If the user unchecks the box then it can stop the service.
So, the service is always running when desired, and is not tied to the Activity, so when the Activity dies the service continues to run.