I have a widget that shows some data fetched from the Internet. I may have multiple widgets visible on the screen, each displaying some data, partly the same as the other widgets.
From time to time I re-fetch the data from the Internet and update the widget views.
I've modeled this in an MVC style: I have a model which I can invoke a "re-fetch-data" on, and which the views listen on.
My questions:
A) Is it wise to let my model be a singleton?
B) Can I rely on that all widgets are served by the same AppWidgetProvider? Or may some of my widgets get served by a different AppWidgetProvider instance? Or, more generally: Is there any guarantee that there will be only one instance of my AppWidgetProvider?
If there is only one instance of my AppWidgetProvider, then I could use an instance variable here for the model, and pass either my AppWidgetProvider or the model around where needed. Perhaps a better option?
C) In the AppWidgetProviders onUpdate
method, can I be sure that the same "context" object is passed as argument each invocation?