title: UWP BLE advertising status is aborted
body: <p>Whenever I start BluetoothLEAdvertisementWatcher from UWP application its status is aborted. Using same functionality in Console application is without a problem (required libraries are included). When I want to pair with BLE device, I use DeviceWatcher from UWP application without the problem.  OS is Win10, and VS2015 Community is used.</p>
  
  <p>To ilustrate the problem, I made an UWP project with Bluetooth included in capabilities:</p>
  
  <pre><code>   &lt;Capabilities&gt;
     &lt;Capability Name="internetClient" /&gt;
     &lt;DeviceCapability Name="bluetooth" /&gt;
     &lt;/Capabilities&gt;
  </code></pre>
  
  <p>There are buttons Start, Stop and View, and TextBlock used for displaying status of BluetoothLEAdvertisementWatcher on MainPage. Code is presented:</p>
  
  <pre><code>public sealed partial class MainPage : Page
      {
          private BluetoothLEAdvertisementWatcher watcher = null;
  
          public MainPage()
          {
              this.InitializeComponent();
  
              watcher = new BluetoothLEAdvertisementWatcher();
              watcher.ScanningMode = BluetoothLEScanningMode.Active;
  
              textBlock.Text = watcher.Status.ToString();
          }
  
          protected override void OnNavigatedTo(NavigationEventArgs e)
          {
              watcher.Received += OnAdvertisementReceived;
  
              watcher.Stopped += OnAdvertisementWatcherStopped;
          }
  
  
          private void StopButton_Click(object sender, RoutedEventArgs e)
          {
              watcher.Stop();
          }
  
          private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs eventArgs)
          {
  
              await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&gt;
              {
                  textBlock.Text = "rcvd" + watcher.Status.ToString();
              });
          }
  
          private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
          {
              // Notify the user that the watcher was stopped
              await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&gt;
              {
                  textBlock.Text = "stopped:" + watcher.Status.ToString();
              });
          }
  
          private void buttonStart_Click(object sender, RoutedEventArgs e)
          {
              watcher.Start();
              textBlock.Text = watcher.Status.ToString();
          }
          private void buttonStop_Click(object sender, RoutedEventArgs e)
          {
              watcher.Stop();
              textBlock.Text = watcher.Status.ToString();
          }
  
          private void buttonView_Click(object sender, RoutedEventArgs e)
          {
              textBlock.Text = watcher.Status.ToString();
          }
      }
  </code></pre>
  
  <p>When the program is started, BluetoothLEAdvertisementWatcher status is Created. After pressing Start button, watcher is started, but status becomes Aborted, and event OnAdvertisementWatcherStopped is triggered (status is still Aborted).</p>
  
  <p>Is there any suggestion for overcoming this problem? Or something that can be additionaly done to clarify the problem?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The application is executed on different laptop. The result is the same, therefore it is not the hardware problem.</p>
  
  <p>There are two recommendations on the web: </p>
  
  <ol>
  <li><p>to enable Bluetooth (it is suggested in the first answer by Dmitry)</p></li>
  <li><p>to check capabilities (
  <a href="https://keyoti.com/blog/bluetooth-low-energy-in-windows-10-troubleshooting-capabilities/" rel="nofollow noreferrer">https://keyoti.com/blog/bluetooth-low-energy-in-windows-10-troubleshooting-capabilities/</a> )</p></li>
  </ol>
  
  <p>None provided result. </p>
  
  <p>Additional remark: when event registration for Stopped is removed, 
  (// watcher.Stopped += OnAdvertisementWatcherStopped;) first result is Started. The next click on button View will display Aborted. For some short fraction of time the result succeeds to be valid.</p>
  
  <p>Any configuration settings suggestion? </p>