开发者

Keeping Widget Alive and Responding

The widget/WidgetProvider lifecycle is not entirely clear to me or what control you have over the how long the widget remains active. By Active I mean able to respond to events and update its remote views. How can you detect when it is no longer responding. I've run my thru the debugger and found that sometimes it stops printing log messages in update, receive etc even when events should be handled. The click no longer passes to receive etc. How do you know detect these changes programatically? I want to be able to detect changes to the widget which would render cause it to be unl开发者_JAVA技巧oaded, or to otherwise stop running. I might want to request that android reload the widget. How would I tell Android to try to reload the widget or get rid of the problem loading widget message? Thanks


I assume you are talking about an AppWidgetProvider? It should never stop "responding". It sounds like your are making some changes via remote views that are removing the pending intents on your clickable views, or you aren't setting the pending intents properly or something. Post your code where you update the remote views.

Are you actually seeing a "problem loading widget" message, or do your pending intents just not seem to fire when clicked?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜