Wednesday, May 9, 2012

Re: [android-developers] Long running Android service is getting recreated over and over


2012/5/10 Dianne Hackborn <hackbod@android.com>
On Wed, May 9, 2012 at 2:48 PM, Kostya Vasilyev <kmansoft@gmail.com> wrote:
Regarding this being an anti-pattern, I'm not sure I fully agree with the widespread opinion on higher battery consumption.

The bigger issue is RAM use.  There just isn't a lot of RAM available on many of these devices, and they can't afford to have tons of apps sitting around consuming it all of the time.  We don't use paging so even if they are sitting there not doing anything their dirty pages can't be paged out.

I see your point about long running processes possibly fighting for RAM, but restarting the process burns up the battery too (you'd previously given a number of about 1 second to launch from Zygote to a running process... maybe it's faster these days).

There is, as far as I can tell, perception that just having a process around somehow increases battery use, even if the device has plenty of free RAM.

This reasoning also ignores cached background processes.

The perception is certainly helped by the multitude of various system-info-management-optimizer apps, many of them being off the mark for both memory and battery usage.

So, Task Killers, Part 2: "The return of paranoia-instilling system tools". See it in 3D at a theater near you.

:)

 
 
But it's the user's perception that matters here, and it's very much against long running services, to the point where I'm sometimes asked why there are three (!!!!!) services in my app, and wouldn't it be better to use one to reduce memory usage by a factor of three, obviously (the answer is no... since the services are sharing the same process).

Wow...  well hopefully that is from people seeing the older Running Services UI that made the separate services much more up-front, rather than the current one which is much more process-oriented.

The built-in settings UI on my GNex with 4.0.4 says something like "<AppName> Processes: 1, Services: 3".

Three is larger than one, so it wins the perception game ("What I tell you three times is true"...)

:)

-- K
 

--
Dianne Hackborn
Android framework engineer
hackbod@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate