Tuesday, October 5, 2010

Notes on updatePeriodMillis in Home App Widget

updatePeriodMillis in Widget Provider Information XML file define How often, in milliseconds, that this AppWidget wants to be updated. The AppWidget manager may place a limit on how often a AppWidget is updated.

If you tried and run the exercise in "A simple Home Screen App Widget with configure activity", it can be noted that:

- The updatePeriodMillis attribute defines how often the App Widget framework should request an update from the AppWidgetProvider by calling the onUpdate() method. The actual update is not guaranteed to occur exactly on time with this value. Refer "App Widget using Alarm Manager" to implement App Widget with higher rate.

- Updates requested with updatePeriodMillis will not be delivered more than once every 30 minutes.

- Only one updatePeriodMillis schedule will be managed for all instances of the App Widget. For example, if the update schedule is defined to be every two hours, and a second instance of the App Widget is added one hour after the first one, then they will both be updated on the period defined by the first one and the second update period will be ignored (they'll both be updated every two hours, not every hour).

No comments: