Cloud Training (Online)




How to enable or disable Bluetooth in Windows Phone using C# ?

If you are a Developer and have an task to change or access the Bluetooth Settings via some user interaction , you can use the Launcher “ConnectionSettingsTask” to achieve it.

Just use the ConnectionSettingsType to Bluetooth and call the show method of the ConnectionSettingsTask . This will Launch the Bluetooth Settings Window and lets the user to change the Bluetooth settings or even enable or disable the Bluetooth.

You use the Launcher , use the namespace Microsoft.Phone.Tasks;

private void LaunchBluetoothSettingsForm()
{
   ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
   connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth;
   connectionSettingsTask.Show();
}

 

via WindowsPhoneRocks.com

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.