Nitesh Kothari
Nitesh Kothari

Reputation: 888

How to discover Bluetooth Low Energy Device(BLE) from Windows Phone 8.1

I am writing a Silverlight Windows Phone 8.1 application, I am trying to connect with Bluetooth Low Energy(BLE) device from Windows Phone 8.1, the device is "HEART RATE", but I'm not getting the result. See my code below.

protected async override void OnNavigatedTo(NavigationEventArgs e)
{
var devices = await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid
                           (GattServiceUuids.HeartRate));
   if (devices.Count > 0)
   {

   }
}

I have also added capability in appmanifest file.

<Capabilities>
 <Capability Name="internetClient"/>
    <m2:DeviceCapability Name="bluetooth.genericAttributeProfile">
      <m2:Device Id="any">
      <m2:Function Type="name:heartRate" />
       <m2:Function Type="serviceId:0000180d-0000-1000-8000-00805f9b34fb" />
     </m2:Device>
</m2:DeviceCapability>

Everything seems fine, but I don't get the output. What's going wrong?

Upvotes: 2

Views: 2420

Answers (1)

user3224741
user3224741

Reputation: 21

The heart rate sensor has to be paired first in the "settings->Bluetooth" on your phone.

Upvotes: 2

Related Questions