Services can't run 24 hours a day. At some point the system will very likely need to kill your process to have memory for elsewhere, and you will go away without a call to onDestroy(). Later the system will restart the process and service.
You just need to deal with this. As far as not restarting the service -- it definitely should. What version of the platform are you seeing this on? What is in the log when it gets killed? What is the output of "adb shell dumpsys activity.services" before and after this happens? Note you can emulate the system killing the process simply by doing it yourself with "ps". On Tue, Dec 15, 2009 at 11:15 AM, Don Park <[email protected]> wrote: > A service is setup by an activity with startService(service_intent). > This service is meant to run 24 hours a day. After some amount of > time, 5 or 6 hours sometimes but its not predictable, the service is > killed. > > The service has an onDestroy: > public void onDestroy() { > rssdb.log("Pigon destroyed"); > rssdb.close(); > notificationManager.cancel(1); > } > > In the database log, the destroyed message does not show up and the > notification #1 is not cancelled. Android makes no attempt to restart > the service. The database log will show the startup of the replacement > service if I trigger it by visiting the activity. What can I do to > keep this service running or at least get it restarted by android > automatically? > > Don > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

