After a few weeks, I've narrowed this down somewhat. But what to do,
I'm not sure.

I suspected that frequent notification updates were clogging up the
phone. As another developer pointed out, the Incredible won't give
foreground priority to services that follow that procedure - this
could be related.

Since my application doesn't reboot the phone, I suspect that

I've tried all kinds of things to reduce the notifications:
1. Not calling AsyncTask.publishProgress more than every six seconds -
logical to do.
2. Rejecting an event in if it is more than six seconds old.
3. Not updating the notification if it has been updated within the
last few seconds.
Finally,
4. Use an atomic boolean as a semaphore to not call publishProgress if
a previous onProgressUpdate has not completed.

The only thing that has worked was when I had a bug that caused the
updates not to be sent at all. In that case, a beta tester managed to
run the service for 24 hours and download 2 gigs in small pieces.
There was absolutely no indication of status - it said 1/215000 the
whole time, but it stayed alive. Put the update back in, and it can't
run for very long.

There is some bug on the Incredible related to notifications from
services. I don't know how to avoid hitting it yet.

Does anyone have any insights?

One of my beta testers might be within travel range to hook up a
debugger, but I'm not sure even that will help.

For reference, this is what I do for updating the notification:

                        // update the text on the ongoing notification
                        message = mDownloadExplanation +  label + " " + num + " 
/ " +
total;

                        RemoteViews contentView = mNotification.contentView;
                        
contentView.setProgressBar(R.id.download_progress_horizontal,
total,
                                        num, false);
                        
contentView.setTextViewText(R.id.download_progress_explanation,
message);

                        long now = System.currentTimeMillis();
                        if(now-mNotification.when>MINTIMEBETWEENUPDATES)
                        {
                                mNotification.when = System.currentTimeMillis();

                                
mNotificationManager.notify(DOWNLOAD_PROGRESS_ID, mNotification);
                        }
                        mUpdateInProgress.set(false);

I've been disappointed enough to consider not using a Service for this
at all, but it still seems like a good fit - for everything but the
incredible.

Nathan

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