It would appear on a G1 (with the latest software update) that onUpdate
() runs even when the widget is not visible. Is there a way of sensing
that the widget is or is not visible or is otherwise in foreground?
That is, running the code below shows a logcat message at whatever
interval the Widget is scheduled to update, whether it's in foreground
or not, whether even the screen is dim or otherwise in deep sleep.

It would seem onUpdate should only be scheduled to run when the Widget
is in the foreground or visible. Is this a defect in the G1, or is
there some other API call to detect if the Widget is visible?


public class HomeScreenWidget extends AppWidgetProvider {

        public static final String TAG = "HomeScreenWidget";


       @Override
       public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[] appWidgetIds) {

                Log.i(TAG, "onUpdate - runs every 6 seconds on G1 - per the
updatePeriodMillis, even when not visible");
       }

}


<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/
android"
            android:minWidth="146dip"
            android:minHeight="146dip"
            android:updatePeriodMillis="6000"
            android:initialLayout="@layout/a_widget_home_screen"
         />


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