saving and loading data in a service

Put your problem here if it does not fit any of the other categories.

saving and loading data in a service

Postby skreamz » Sat Jul 10, 2010 8:52 pm

Hi all,

On my app I have a sticky service which saves and loads data. via SharedPreferences using MODE_PRIVATE.

the data gets saved in the Service.onDestroy() and gets loaded in the Service.onCreate(). the service can be started via the app or via the BroadcastReciever when the system :| boots up.

and this works perfectly on the nexus one and emulators which i use for testing, but people using the desire and htc2 are not having persistant data through device reboots. and I'm just wondering if anyone would have any ideas why?

thanks in advance.

a little bit more info on how the app works.

i use a Globals class with a

static public MyService service = null;

when the app is first runs, from MyActivity it checks if the service is running via

if(Globals.service == null)
//starts the service

and Globals.service.Savedata() gets called on MyActivity.onDestroy(). //as data is only changed within the activity
when the service starts, it loads anysaved data in MyService.onCreate().

now on system boot, the service is started my the system and Globals.service = MyService.this.

i have no problems what so ever on nexus one and emulators, but the desire (basically i have no idea).
and im hoping someone might.

thanks again.
Once Poster
Once Poster
Posts: 1
Joined: Sat May 22, 2010 5:52 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 7 guests