On Sat, Dec 11, 2010 at 9:06 AM, String <[email protected]>wrote:

> You might also be running into ANR limits, which can vary by device/build.
> Just because your code is running in a service doesn't make it immune from
> ANR, and I've noticed that recent OS versions summarily kill ANR processes
> in appwidgets, rather than showing the user a dialog.


ANRs for background processes have never been shown on user builds (no
reason to annoy the user about them); they have always been shown on
development builds (such as running in the emulator).

Also to the original poster -- Service.setForeground() will basically
guarantee that your process doesn't get killed for normal memory management.
 It will only be killed if it has crashed (either in Java, where you will
see the crash in the log, or in native code, which is harder to debug), has
extremely used a lot of memory to the point where nothing else can run, or
has had an ANR.


> If this is happening, you should be able to see it in LogCat, and you might
> try moving your code into a background thread, as with an AsyncTask.
>

Yes, you absolutely should be looking at logcat.  In fact if you aren't
posting your logcat output from the time it gets killed, that is the first
thing we all should ask about. :)

-- 
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

Reply via email to