Introduction To Microsoft Band

We are going to discuss the Microsoft Band prerequisites and what are all the features available on Band SDK.

Microsoft Band:

Microsoft Band is a smart wearable device launched by Microsoft. It allows developers to access the sensor available on the Band, and you can creat own application to track your heart rate, calories burn, exercise and so on.

The list of features of Band SDK:

  1. Support multi-platform
  2. Sensor data subscriptions
  3. Tiles creation and management
  4. Tiles notification
  5. Haptic notification
  6. Custom layouts
  7. Band theme personalization

Requirements

  1. Microsoft Band
  2. Visual Studio 2013 and above

Prerequisite

  1. Microsoft Band
  2. Microsoft Band SDK
  3. Visual Studio 2015

We can develop apps using bank SDK with a different platform such as Windows, iOS, Android in the minimum requirements as in the following,

  1. Windows Phone 8.1 and above
  2. Windows 8.1 and above
  3. iOS 7 and above
  4. Android 4.2 and above
 
Image Source: Microsoft Store

Step 1:

Open Visual Studio 2015 and go to file menu and point new and then click new project, where you can see the section Visual C# Template. Click Windows 8, Universal, then select Blank App (Universal Windows 8.1) and type Project Name HelloWordBandDemo, Choose the project location path and then click OK button.

Go to Solution Explorer and right click the project name and then click Manage NuGet Packages,

  

NuGet Package Manager window will open and you can type Microsoft Band and browse. Also select Microsoft.Band and click Install button.

  

Preview window will open and you can see the Microsoft Band version installing details. Click OK button. License Acceptance will open and you can see the license terms and then click I Accept button.

  

After it is successfully installed in Microsoft Band, you can see the following,

 
 
You can see HelloWordBandDemo project structure as in the following screenshot.
 
  

After successfully installing the Microsoft Band SDK, Double click the Package.appxmanifest file then you can seen the left side information in the apps. Select the Proximity checkbox and save the package changes as in the following,

 
 
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">  
  3.   <Identity Name="20225b23-1ba4-4c87-a2a5-2fb2e85f8f02" Publisher="CN=Santhakumar" Version="1.0.0.0" />  
  4.   <mp:PhoneIdentity PhoneProductId="20225b23-1ba4-4c87-a2a5-2fb2e85f8f02" PhonePublisherId="00000000-0000-0000-0000-000000000000" />  
  5.   <Properties>  
  6.     <DisplayName>HelloWordBandDemo.WindowsPhone</DisplayName>  
  7.     <PublisherDisplayName>Santhakumar</PublisherDisplayName>  
  8.     <Logo>Assets\StoreLogo.png</Logo>  
  9.   </Properties>  
  10.   <Prerequisites>  
  11.     <OSMinVersion>6.3.1</OSMinVersion>  
  12.     <OSMaxVersionTested>6.3.1</OSMaxVersionTested>  
  13.   </Prerequisites>  
  14.   <Resources>  
  15.     <Resource Language="x-generate" />  
  16.   </Resources>  
  17.   <Applications>  
  18.     <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="HelloWordBandDemo.WindowsPhone.App">  
  19.       <m3:VisualElements DisplayName="HelloWordBandDemo.WindowsPhone" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="HelloWordBandDemo.WindowsPhone" ForegroundText="light" BackgroundColor="transparent">  
  20.         <m3:DefaultTile Wide310x150Logo="Assets\WideLogo.png" Square71x71Logo="Assets\Square71x71Logo.png">  
  21.         </m3:DefaultTile>  
  22.         <m3:SplashScreen Image="Assets\SplashScreen.png" />  
  23.       </m3:VisualElements>  
  24.     </Application>  
  25.   </Applications>  
  26.   <Capabilities>  
  27.     <Capability Name="internetClientServer" />  
  28.     <DeviceCapability Name="proximity" />  
  29.     <DeviceCapability Name="bluetooth.rfcomm" xmlns="http://schemas.microsoft.com/appx/2013/manifest">  
  30.       <Device Id="any">  
  31.         <!-- Used by the Microsoft Band SDK -->  
  32.         <Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />  
  33.         <!-- Used by the Microsoft Band SDK -->  
  34.         <Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />  
  35.       </Device>  
  36.     </DeviceCapability>  
  37.   </Capabilities>  
  38. </Package>  
Step 2: Add Microsoft Band namespace,
  1. using Microsoft.Band;  
Step 3: For getting the list of Microsoft Band paired to your phone device, we need to call the method GetBandsAsync() from the BandClientManager class,
  1. IBandInfo[] bandPair = await BandClientManager.Instance.GetBandsAsync();  
Step 4: Connect to the Band App paired Microsoft Band, we need to pass bandPair parameter to the ConnectAsync method,  
  1. try  
  2.             {  
  3.                 using (IBandClient bandClient = await BandClientManager.Instance.ConnectAsync(bandPair[0]))  
  4.                 {  
  5.                     // implement band information retreiving logic code here  
  6.   
  7.                 }  
  8.             }  
  9.             catch (BandException ex)  
  10.             {  
  11.                 // handle the band connection expection to here  
  12.                 throw ex;  
  13.             }  
Conclusion

This article helps you to understand Microsoft Band and how to connect band apps using Visual Studio 2015. Thank you for reading my articles. Kindly share your comments or suggestions.

Up Next
    Ebook Download
    View all
    Learn
    View all