开发者

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 wip开发者_JAVA百科ing 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


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.


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


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜