Now we have this great article:
http://android-developers.blogspot.com/2010/04/multitasking-android-way.html
Services can further negotiate this behavior by requesting they be
considered foreground. This places the service in a please don't kill
state, but requires that it include a notification
My impression, not well investigated, is that your service is NOT
likely to be killed while it is actually running on the main thread
doing processing. I'm guessing you're doing this on a separate thread?
Your process may be killed, but is less likely to be killed, if you
start the service, and
Does Android even do anything with thread priority?
In my experience: Yes.
You can set a Thread's priority and it has an effect. Note, however,
that the actual priority will never be higher than the groups
priority.
When i change a background thread's priority and set it very high, the
UI
Ok, I'll explain in detail. There are two issues in this story: (a)
killability of the service (b) execution prio of the service
In the good old days I just
used Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST) in my
service and things went wonderfully. My sync service ran and took as
*bump*
It seems that the implementation of startForeground() delegates to this
code:
public void setServiceForeground(ComponentName className, IBinder token,
1781 #127f1bc903f2e1c4_l1781int id, Notification
notification, boolean removeNotification) throws RemoteException {
1782
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
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
My point is that the documentation says nothing at all about raising the
execution prio, but you say now that it does, right?
What the documentation says is that startForground() helps that the process
doesn't get killed and that's what I was after, because it is a costly
process wasting bandwidth
Quoting myself:
And you have done so wonderfully.
What is it your trying to say though?
That it is ok to raise the priority when I don't want my process to be
killed.
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this
Mariano Kamp wrote:
Quoting myself:
And you have done so wonderfully.
What is it your trying to say though?
That it is ok to raise the priority when I don't want my process to be
killed.
I'm saying what Ms. Hackborn confirmed in her reply to my post --
startForeground() elevates
1) CPU is not a problem per se. My process can happily be starved of CPU,
but as it needs to do xml parsing it does task the CPU albeit at it's lowest
prio.
2) As I said I rely on an external API that doesn't understand incremental
updates.
Anyway, I think there is no good solution and the
Why do you want to use startForeground()? What is it giving you? If you
want your code to run in the background, it is probably not what you want.
On Mon, Apr 12, 2010 at 2:04 PM, Mariano Kamp mariano.k...@gmail.comwrote:
1) CPU is not a problem per se. My process can happily be starved of
12 matches
Mail list logo