On Fri, Nov 20, 2009 at 14:53, dadical <keyes...@gmail.com> wrote:
> If you're running on a G1, and have even low-mid memory reqs, you are
> pretty much SOL.  Android will kill off processes to free resources
> for new foreground activities, and services, particularly those
> running in a background process, will get axed first.  Watch logcat in
> verbose mode to validate that this is indeed what is happening.
>
> Things are going to get even worse for you in 1.6.  Donut itself
> consumes more memory leaving less room for your background service.
> Once a foreground activity is bound to your service, the service will
> be much less likely to get killed, so your only option in low-mem
> scenarios may be to check at binding time and see if your persistent
> connection is available, and reconnect if not.  This approach is the
> best solution that I can think of for gracefully "degrading" the
> functionality of your service in low-mem situations.
>

Indeed on my magic, logcat often shows that background processes were
killed while booting due too low memory, even before I could do
anything. (yes I am trying to reduce as much unuseful apps as
possible... what is bad is theses apps I do not need to autostart
though I do not want to uninstall).

But if your service process is killed due to low memory, won't the
system try to restart it later ? (though of course if there are still
too many services running there is still a problem)

And anyway, your could at boot time just set an alarm to defer the
initialisation of your service. So that a lot of processes that where
running at boot time will have finished and more resources are
available.
You may also still try to do your job immediatly, but before that set
an alarm in case of. (But in case of low memory this will just slow
down the phone at startup, for nothing.)

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