Reputation: 178
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
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