user375066
user375066

Reputation:

Widget Update when user switches homescreen

Is there an Event that is fired when an widget becomes visible on to the homescreen. I didn't mean at install time, I mean if the user changes his homescreen by wiping the surface of the phone. The background of this question is that I setup a timer in a service inside the widget that gets updates from a url but that should stop if the widget is not on the current homescreen.

Freudi

Upvotes: 1

Views: 1204

Answers (3)

Snailer
Snailer

Reputation: 3839

Not sure if this helps, but I stumbled across this..

WallpaperManager.setWallpaperOffsets() and WallpaperService.onOffsetChanged()

Perhaps you could use this? Set wallpaper offsets and use onOffsetChanged() to get current offsets?

Upvotes: 0

srinathhs
srinathhs

Reputation: 2038

There is a way to do that, you can listen to Intent.ACTION_USER_PRESENT broadcast and update your widget on receiving the intent.

It will be fired when the user unlocks the home screen.

I am using it in my app and works great to update your widgets upon unlock.

Upvotes: 3

CommonsWare
CommonsWare

Reputation: 1006674

No, sorry. There are dozens of home screen applications, some of whom may not even have the concept of "wiping the surface of the phone". A home screen is merely an activity with a particular <intent-filter>.

Upvotes: 1

Related Questions