How to Develop an App For Microsoft Band

The new version of the Microsoft Band SDK, version 1.3.10518, was released on May 21, 2015 and allows developers to play around with the Microsoft Band. The SDK gives developers access to the sensors available on the Band as well as the ability to create Tiles on the Band.

The new SDK includes the following:

  • Multi-Platform support.
  • Sensor data subscription.
  • Tile creation and management.
  • Tile Notification.
  • Custom layouts.
  • Haptic notification.
  • Band theme personalization.

Overview of Microsoft Band

Microsoft Band
Figure 1: Microsoft Band

Microsft Band is a device worn as a bracelet with a Touchscreen display and sensors as in the following:

  • Accelerometer sensor 3-axis(XYZ).
  • Gyro meter sensor provide XYZ angular Velocity in degree.
  • Optical hear rate sensor provides number of beats per minute.
  • GPS
  • Temperature Sensor
  • UV sensor
  • Capacitive sensor
  • Galvanic Skin response*
  • Ambient light sensor*

These are currently not accessible through the SDK.

The following image shows the axes for the gyrometer and accelerometer sensors.

Axes for gyro meter and accelerometer sensor
Figure 2: Axes for gyrometer and accelerometer sensor

Requirements

For the Windows platform we require Visual Studio 2013 or higher to develop a Microsoft Band App. The Microsoft Band SDK latest version 1.3.10518 was released on May 21, 2015.

Procedure to install Microsoft SDK

Create a new Windows Phone or Windows Universal project. Here I have created a Windows Phone 8.1 project and selected Manage NuGet Packages as shown in the following screen.

Manage NuGet Packages
Figure 3: Manage NuGet Packages

Now search for and install the Microsoft Band SDK as shown in the following screen.

Microsoft Band SDK
Figure 4: Microsoft Band SDK

After installing the Microsoft SDK check that the Proximity capability has been added to the manifest file as in the following:

Proximity capability
Figure 5: Proximity capability

Enable Proximity

Add the  following code to the Package.appmanifest file. Right-click the appmainfest file and select View Code to add the code.

  1. <DeviceCapability Name="bluetooth.rfcomm" xmlns="http://schemas.microsoft.com/appx/2013/manifest">  
  2.    <Device Id="any">  
  3.       <Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />  
  4.       <Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />  
  5.    </Device>  
  6. </DeviceCapability> 

The first step is to connect to the Band. To make the connection, the band and the device must be paired with Bluetooth. To get the paired Band and establish a connection use the Band Client Manager.

First add the namespace as in the following:

  1. using Microsoft.Band; 

Next get the list of paired Bands using the following code.

  1. IBandInfo[] getPairedDevice=await BandClientManager.Instance.GetBandsAsync(); 

Connect to the band.

  1. using(IBandClient client=await BandClientManager.Instance.ConnectAsync(getPairedDevice[0]))  
  2. {  
  3.    //do your stuff here  

In this sample I will get the Band firmware version and hardware version.

The following is the code to get the band version.

  1. using(IBandClient client=await BandClientManager.Instance.ConnectAsync(getPairedDevice[0]))  
  2. {  
  3.    string bandVersion = await client.GetFirmwareVersionAsync();  
  4.    string bandHWversion = await client.GetHardwareVersionAsync();