How to detect the audio endpoint device in Windows Phone 8 App ?

This blog post will explain how to detect the audio endpoint device that is connected to the Windows Phone 8 device .

How to detect the audio endpoint device in Windows Phone 8 App ?

The Windows Phone 8 SDK provides the VOIP AudioRoutingManager API which can be used to determine the connected audio endpoint device.

The AudioRoutingManager has the method GetAudioEndpoint which returns the AudioRoutingEndpoint . The AudioRoutingEndpoint is a enum which contains one of the values (Earpiece,Speakerphone,Bluetooth,WiredHeaset,WiredHeadsetSpeakerOnly,BluetoothWithNoiseAndEchoCancellation,Default).

image

Here’s a codesnippet to get the audio endpoint device that is connected.

AudioRoutingEndpoint current = AudioRoutingManager.GetDefault().GetAudioEndpoint();           
MessageBox.Show(current.ToString());

image

Note that you need to add the ID_CAP_VOIP capability in your WMAppManifest file or else you will receive the following error when trying to access the endpoint.

image

An exception of type ‘System.UnauthorizedAccessException’ occurred in MobileOSGeekApps.DLL but was not handled in user code

Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...