Listing 1012 Setting the App Widget minimum update rate

<?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:initialLayout="@layout/my_widget_layout" android:minWidth="146dp" android:minHeight="146dp" android:label="My App Widget" android:updatePeriodMillis="3600000"

Available for download on Wrox.com

Setting this value will cause the device to broadcast an Intent requesting an update of your widget at the rate specified.

The host device will wake up to complete these updates, meaning they are completed even when the device is on standby. This has the potential to be a significant resource drain, so it's very important to consider the implications of your update rate.

This technique should be used to define the absolute minimum rate at which your widget must be updated to remain useful. Generally the minimum expected update rate should be at least an hour, ideally not more than once or twice a day.

If your device requires more frequent updates, consider using one of the techniques described in the following sections to dynamically perform updates using either an event/Intent-driven model or a more efficient scheduled model using Alarms.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment