Yep startForeround() does what it says -- tells the system it should treat your service as if it is in foreground, something the user is aware of. A typical example is "background music playback," which needs to get as much CPU as it needs in order to avoid a bad user experience.
Generally, if you want your threads to run in the background, that would imply to me that your service is not one that wants to run in the foreground so should not be requesting to do so. On Mon, Apr 12, 2010 at 10:51 AM, Mark Murphy <[email protected]>wrote: > Mariano Kamp wrote: > > Is that a coincidence or does startForeground() mess > > with the thread's prio or does anything else but what is written > below? > > Quoting myself: > > "...but a persistent concern for game developers on Android is the > impacts that external forces have on their frame rates. For example, a > year ago, the big concern was garbage collection going on in other > processes -- garbage collection takes CPU time, even if that work is > being done in a totally separate Linux process from the game itself. > > To counteract this, the core Android team made some improvements in > Android 1.6, relegating all background processing to a class that is > capped in terms of CPU utilization, leveraging some Linux process and > thread control frameworks. Garbage collection in those background > processes will no longer hog the CPU. Hence, games can run with minimal > interference...so long as background processing stays in the background." > > (from > http://www.androidguys.com/2010/03/16/code-pollution-background-foreground/ > ) > > I suspect that startForeground() means the service will run with > foreground priority, rather than residing in the background process class. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Android Training in NYC: 30 April-2 May 2010: http://guruloft.com > > -- > 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 > > To unsubscribe, reply using "remove me" as the subject. > -- 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

