XboxGameBarWidgetActivity

This object can be used to keep Game Bar running in the background to support long-running widget background tasks for relevant active user scenarios, such as supporting a voice chat session that can span multiple hours when both Game Bar and the widget are dismissed off screen.

Constructor

XboxGameBarWidgetActivity(XboxGameBarWidget widget, String activityId);

Constructs a new activity associated with this widget.

Throws if provided activityId already exists for this widget.

Properties

String Id

Gets the current activityId.

Methods

void Complete()

Explicitly stops the current activity (note: this happens automatically when the object falls out of scope).

void Restart()

Reactivates a completed activity. Use this when you need to resume an activity that was previously completed rather than creating a new activity instance.

Static Methods

The following static methods return predefined activity ID strings for common microphone-related scenarios. These activity IDs enable Game Bar to display appropriate audio status indicators.

GetMicrophoneInputActivityId

static String GetMicrophoneInputActivityId()

Returns the activity ID string "AudioStatus".

Use this activity ID to indicate that your widget is actively using microphone input. This is the base microphone activity that signals to Game Bar that audio capture is occurring.

GetMicrophoneInputLoadingActivityId

static String GetMicrophoneInputLoadingActivityId()

Returns the activity ID string "AudioStatusLoading".

Use this activity ID to indicate that your widget is loading or initializing microphone input. This signals to the user that microphone setup is in progress.

GetMicrophoneInputUserSpeakingActivityId

static String GetMicrophoneInputUserSpeakingActivityId()

Returns the activity ID string "AudioStatusUserSpeaking".

Use this activity ID to indicate that the user is actively speaking into the microphone. This provides real-time feedback that voice input is being detected.

GetMicrophoneInputSpeakerOutputActivityId

static String GetMicrophoneInputSpeakerOutputActivityId()

Returns the activity ID string "AudioStatusSpeakerOutput".

Use this activity ID to indicate that audio is being output through speakers, such as during voice chat playback from other participants.

Visual Behavior

When any of the microphone activities are active, Game Bar displays an audio status widget with a microphone icon at the bottom-center of the screen. This provides users with a visual indicator that audio features are in use.

Visual Precedence

When multiple microphone activities are active simultaneously, Game Bar displays the indicator based on the following precedence order (highest to lowest):

  1. SpeakerOutput - Audio playback takes highest priority
  2. UserSpeaking - Active voice input takes second priority
  3. Loading - Initialization state takes third priority
  4. Status - Base microphone activity has lowest priority

This precedence ensures users see the most relevant audio status at any given time.