IWidgetProvider.Activate(WidgetContext) Method

Definition

Notifies the widget provider that the widget host is currently interested in receiving updated content from the provider.

public:
 void Activate(WidgetContext ^ widgetContext);
void Activate(WidgetContext const& widgetContext);
public void Activate(WidgetContext widgetContext);
function activate(widgetContext)
Public Sub Activate (widgetContext As WidgetContext)

Parameters

widgetContext
WidgetContext

A WidgetContext object that identifies the widget that is being activated and provides configuration information.

Remarks

The Deactivate(String) method is called to notify the widget provider that the widget host is no longer requesting content updates. These two methods define a window in which the widget host is most interested in showing the most up-to-date content. Widget providers can send updates to the widget at any time, such as in response to a push notification, but as with any background task, it's important to balance providing up-to-date content with resource concerns like battery life.

Activate and Deactivate are called on a per-widget basis. Note that the time window between Activate and Deactivate may be small, so it's recommended that you try to make your widget update code path as quick as possible.

Note that when a widget is first created, as indicated by a call to CreateWidget(WidgetContext), it is in the active state.

Objects passed into this callback method are only guaranteed to be valid within the callback. You should not store references to these objects because their behavior outside of the context of the callback is undefined.

Applies to