On Thu, Jun 23, 2011 at 10:48 AM, mexibec <[email protected]> wrote:
> Folks, I got an AppWidget working great, but I need it to be updated
> whenever it is visible. It doesn't need to be refreshed if the user is
> not looking at it. For instance, if the device is sleeping, or if it
> sits on a home screen that the user is not looking at, then it needs
> no update. But the second it becomes visible, it needs to be updated,
> and then periodically every minute, until it's no longer visible, at
> which point it doesn't need any update, and so on.
>
> Setting an intent SCREEN_ION does not work. I don't want to sleep an
> alarm when it's not visible (especially not every minute!) Any idea
> about how I can achieve this?

Update it every minute, regardless of whether it is visible. Use
AlarmManager and a non-WAKEUP alarm instead of
android:updatePeriodMillis if you do not want to wake up the phone.
Ideally, you would allow the user to configure the update interval --
while you may think every minute is a fine answer, users may disagree.

> FYI, back in the Pocket PC/Windows Mobile era, the Today screen plug-
> ins had those features i.e. the plug-ins would be notified when
> visible, and periodically afterwards. This is what I'm looking for
> because that perfectly fits my apps requirements.

This is not possible, sorry.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1, http://bit.ly/smand2

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to