Dirk
Dirk

Reputation: 11

Widget notification when homescreen app is restarted?

I'm developing a widget which gets updated via intents. However, when the homescreen app (tested with ADWLauncher EX, the default Android homescreen and HTC Sense) is restarted, the widget is displayed with it's default layout, and no notification event is received to update the widget's content. No widget added or widget updated events/intents seem to get fired. Is there any way for a widget to get notified when the homescreen app is restarted and the widget is (re)displayed?

Thanks!

Upvotes: 1

Views: 1247

Answers (1)

Jim Vitek
Jim Vitek

Reputation: 4214

There may not be a reliable way to detect launcher restart on all platforms. I have seen ONLY com.sec.android.widgetapp.APPWIDGET_RESIZE on Samsung Touchwiz android 4.0.4, and ONLY android.appwidget.action.APPWIDGET_UPDATE_OPTIONS on Jellybean 4.1.1, and nothing on several other builds I tested.

That said, when I encountered a problem similar to what you describe, the root cause was improper use of RemoteViews. Check your code to ensure you are only using one instance of RemoteViews for all updates. If you are continually using a new instance of RemoteViews in your code, many of the updates to your appwidget will be lost the next time it restarts.

Similar question: Widget not updated on launcher restart

Upvotes: 2

Related Questions