1

in numerous places, it is mentioned that app widgets should not get updated often, to minimize power consumption.

But, let's consider that an application is doing something important (such as audio recording) for a short period of time, say 30min.

In this case, is it acceptable to update the widget every second from a service?

How can it be that this would consume so much power?

Please consider that this is different from a widget which would update very often during the whole day.

And in my case, such frequent updates would be meant to allow the user to monitor that the operation is being performed continuously and correctly. It's not for fancy visual effects and such.

jimmym715
  • 1,512
  • 1
  • 16
  • 25
olivierg
  • 10,200
  • 4
  • 30
  • 33
  • I'm asking this question after a discussion on: http://stackoverflow.com/questions/5764099/how-to-update-a-widget-if-the-related-service-gets-killed – olivierg Apr 23 '11 at 15:55
  • AFAIK high power consumption is unavoidable in this kind of situations. You could however obviate that the action is been performed with a status label or a notification in the top bar. – Vicente Plata Apr 23 '11 at 15:56
  • @Vicente: I already have a notification (a foreground service is performing the job), but I need to display the status very regularly so that the user can ensure that everything's ok. But what you are saying about "power consumption is unavoidable in this kind of situations" is interesting. I would need to measure the actual power consumption of widget updates and see how much that makes of the total power usage while the job's being performed. But how to do that? – olivierg Apr 23 '11 at 16:06

2 Answers2

2

I don't see a problem with doing this; if you're keeping the phone awake with a long-running background task (audio recording in this case), then the phone can't sleep anyway. I wouldn't expect updating the widget to have a significant impact on battery use in this case.

Of course, the best thing to do is to run some tests on a real device, and compare battery use with and without widget updates, and make widget update interval a user preference.

Phil Lello
  • 8,377
  • 2
  • 25
  • 34
  • 3
    Thanks for this answer. I intuitively agree with you. I also thought about the configurable update interval. Measuring battery usage on a real device seems like a very good idea. But you know, the thing is that there is such a stress about how frequent widget updates are "bad" in the docs and here on SO, that confuses me. I would love to see some benchmarks about widget update power consumption. Or some real world example about why doing this too frequently is a problem. – olivierg Apr 23 '11 at 16:14
0

The main reason widgets shouldn't update constantly is because of the battery consumption used to get the latest data from a server. Since the device will be on anyway, and the update is local to your data, it shouldn't have an impact that is noticeable.

If you were hitting a server instead of local data every second for that long, you would notice a significant draw on the battery.

Mikecito
  • 2,053
  • 11
  • 17
  • the main hit would be from the cell-data connection more so than the widget's data processing. Unless the application/widget was doing heavy data processing. – Dr.J Apr 23 '11 at 16:13
  • 1
    Hmm, are you guys sure about this? What I've read is that a widget update is heavy in general (and not only if it involves network operation), because it implies calls to a remote process. RPC apparently isn't power-friendly on Android. – olivierg Apr 23 '11 at 16:17
  • I'm not sure about the specific power draws on each situation, but if a remote process call takes as much batter power draw as a call through the wifi/cell data... then there are larger issues at hand. I would love to see a spec on this somewhere. – Mikecito Apr 23 '11 at 16:21