I forgot to add that the service is running on a T-Mobile G1 phone
(Android 1.6). It pushes periodic GPS fixes to a web service. (Google
Latitude does not fill the requirements in this case :)

Don

On Dec 15, 12:05 pm, Don Park <don.p...@gmail.com> wrote:
> I understand that a service can be bumped out of ram, though I
> expected this to happen infrequently enough, with a quick enough
> restart time, that the service was effectively running 24 hours a day.
> a 10 minute gap for instance would be fine.
>
> When a service is deemed unnecessary, its killed outright (meaning
> killed at the unix process level)? with no callback or chance to
> cleanly shutdown? I'm surprised by that. When *does* onDestroy get
> called? I use a notification icon to alert the user that the service
> is indeed running. With the service killed, it appears to the user
> that the service is not killed as the notification is not removed.
>
> I cannot say why the service is not being restarted. I just started
> the app in the emulator but a kill nor a kill -9 make the app do
> anything in the emulator - it continues to run. I do not see a process
> listing for the service, just the package name for the whole app.
> Should I be seeing a seperate process for a service?
>
> # ps
> ...
> app_24   217   29    115908 24880 ffffffff afe0d4a4 S
> com.icecondor.nest
>
> # kill app_24
> # kill -9 app_24
> (no change in the emulator, the app is still responsive in the
> emulator)
>
> I'm going to try leaving the phone running tonight with an 'adb
> logcat' running to try and get some android system messages at the
> time the service dies, in addition to the database log i mentioned in
> the last email.
>
> Thanks for the help,
> Don
>
> On Dec 15, 11:47 am, Dianne Hackborn <hack...@android.com> wrote:
>
> > 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 <don.p...@gmail.com> 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 android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
>
> > 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to