I have a Service which performs some file I/O. I would like to display the file which the Service is currently working with in the notification of the Service. I can update the notification according to
http://developer.android.com/guide/topics/ui/notifiers/notifications.html#Updating
but as this blog post says, I should be careful about too frequent updates (which might occur for small files). So what is a good solution? I don’t even need the updates if the user hasn’t pulled down the notification area. Should I check for this? Should I use an updating time?
The more frequent the updates are the better (for the user to see the most recent activity of the service), but higher CPU load is worse.
Is there a standard pattern to work with?
Since you are already putting heavy load on the CPU with your IO activity, your notifications won’t be much of an extra burden.
The recommendation against too-frequent updates applies mostly to situations when the phone is in standby and needs to be woken up to process each notifications, which drains the battery.
However, if you are processing lots of small files, the updates are too fast for the user to read and may appear as a flicker, so for that reason you may want to only update every few seconds.