Dela via


BackgroundMediaPlayer.SendMessageToForeground(ValueSet) Method

Definition

Sends a message to the foreground task.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

public:
 static void SendMessageToForeground(ValueSet ^ value);
 static void SendMessageToForeground(ValueSet const& value);
/// [Windows.Foundation.Metadata.Deprecated("Use MediaPlayer instead of BackgroundMediaPlayer.  For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 262144, "Windows.Foundation.UniversalApiContract")]
 static void SendMessageToForeground(ValueSet const& value);
public static void SendMessageToForeground(ValueSet value);
[Windows.Foundation.Metadata.Deprecated("Use MediaPlayer instead of BackgroundMediaPlayer.  For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 262144, "Windows.Foundation.UniversalApiContract")]
public static void SendMessageToForeground(ValueSet value);
function sendMessageToForeground(value)
Public Shared Sub SendMessageToForeground (value As ValueSet)

Parameters

value
ValueSet

Set of values representing the message.

Attributes

Remarks

Apps should only call SendMessageToForeground while the foreground app is running. Attempting to call this method while the foreground app is not running will throw an exception. An app is responsible for communicating the foreground app state to the background process. This can be done using app lifecycle events, state values kept in local storage, and messages between processes.

Calls to SendMessageToForeground should always be made within a try block so that the exception thrown can be caught if the system is unable to send the message.

Applies to