OK. Though this service needs a state, which should be possible to be altered at any time. I could store it to the hard drive, but all that loading and saving files would be waste of time, too. So do you suppose it'd take less resources if I'd use the intent to "start" the service over and over (and use a startup parameter to tell it that it's time to do something, and the service would hold the persistent state)?
Also thanks for the Handler tip, I totally forgot about that. If nothing else, I'll use that instead. hackbod wrote: > Please look at the API demos for Alarm Service and Alarm Controller: > > http://code.google.com/android/samples/ApiDemos/src/com/google/android/samples/app/ > > If you really want your service to be always running (which we would > prefer, because if it is sitting there not doing anything its > resources may be better used elsewhere), then you can use a Handler to > scheduled delayed messages. > > On Apr 10, 6:57�am, NTR <[EMAIL PROTECTED]> wrote: > > As said here: > > > > http://groups.google.com/group/android-developers/browse_thread/threa... > > > > I noticed the same - Thread.sleep, and also TimerTasks, take 100% of > > my PC's CPU, and also bring the emulator to its knees. I'd like to run > > a service in the background that does things every now and then, do > > you know any workarounds for this issue? :/ It really kills my > > application... > > > > I'm running something only every 2 minutes (confirmed from the logs), > > but still, the emulator basically hangs whenever Thread.sleep is > > called (of course I'm not doing that in the main thread, but just as I > > tried to emulate TimerTasks, since they hanged as well)... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---