Ethan
Ethan

Reputation: 178

How could i enable bluetooth in Windows phone 8 After Checking Disbale of Bluetooth

i want to check whether bluetooth is enabled or not. If bluetooth is not enabled means i will ask one popup says(Allow the bluetooth to on (yes/no)) Based one the response I need to proceed.

If user pressed Yes means how could i enabled bluetooth in windows phone 8 device. without redirecting to the bluetooth page.

I tried looking this thread

Upvotes: 1

Views: 708

Answers (1)

anderZubi
anderZubi

Reputation: 6424

You cannot directly enable Bluetooth from code, but instead, you can bring the user to the Bluetooth setting page by using ConnectionSettingsTask launcher:

ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth;
connectionSettingsTask.Show();

See: How to use the connection settings task for Windows Phone

More about Launchers and Choosers here.

The Bluetooth settings page can also be launches using a URI scheme:

Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-bluetooth:"));

See more here.

Upvotes: 2

Related Questions