Click here to Skip to main content
15,893,161 members
Articles / Enterprise

Introduction to Microsoft Band

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
24 Jan 2016CPOL2 min read 5.1K  
Introduction to Microsoft Band

This article explains about Microsoft Band and its features with a sample band connect app using Visual Studio 2015.

We are going to discuss the Microsoft Band prerequisites and 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 create your own application to track your heart rate, calories burn, exercise and so on.

The list of features of Band SDK are as follows:

  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 band 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 see the left side information in the apps. Select the Proximity checkbox and save the package changes as in the following:

XML
<?xml version="1.0" encoding="utf-8"?>
<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">
  <Identity Name="20225b23-1ba4-4c87-a2a5-2fb2e85f8f02"
  Publisher="CN=Santhakumar" Version="1.0.0.0" />
  <mp:PhoneIdentity PhoneProductId="20225b23-1ba4-4c87-a2a5-2fb2e85f8f02"
  PhonePublisherId="00000000-0000-0000-0000-000000000000" />
  <Properties>
    <DisplayName>HelloWordBandDemo.WindowsPhone</DisplayName>
    <PublisherDisplayName>Santhakumar</PublisherDisplayName>
    <Logo>Assets\StoreLogo.png</Logo>
  </Properties>
  <Prerequisites>
    <OSMinVersion>6.3.1</OSMinVersion>
    <OSMaxVersionTested>6.3.1</OSMaxVersionTested>
  </Prerequisites>
  <Resources>
    <Resource Language="x-generate" />
  </Resources>
  <Applications>
    <Application Id="App" Executable="$targetnametoken$.exe"
    EntryPoint="HelloWordBandDemo.WindowsPhone.App">
      <m3:VisualElements DisplayName="HelloWordBandDemo.WindowsPhone"
      Square150x150Logo="Assets\Logo.png"
      Square44x44Logo="Assets\SmallLogo.png"
      Description="HelloWordBandDemo.WindowsPhone"
      ForegroundText="light" BackgroundColor="transparent">
        <m3:DefaultTile Wide310x150Logo="Assets\WideLogo.png"
        Square71x71Logo="Assets\Square71x71Logo.png">
        </m3:DefaultTile>
        <m3:SplashScreen Image="Assets\SplashScreen.png" />
      </m3:VisualElements>
    </Application>
  </Applications>
  <Capabilities>
    <Capability Name="internetClientServer" />
    <DeviceCapability Name="proximity" />
    <DeviceCapability Name="bluetooth.rfcomm"
    xmlns="http://schemas.microsoft.com/appx/2013/manifest">
      <Device Id="any">
        <!-- Used by the Microsoft Band SDK -->
        <Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />
        <!-- Used by the Microsoft Band SDK -->
        <Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />
      </Device>
    </DeviceCapability>
  </Capabilities>
</Package>

Step 2

Add Microsoft Band namespace:

C#
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.

C#
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.

C#
try  
       {  
           using (IBandClient bandClient = await BandClientManager.Instance.ConnectAsync(bandPair[0]))  
           {  
               // implement band information retreiving logic code here   
           }  
       }  
       catch (BandException ex)  
       {  
           // handle the band connection exception to here  
           throw ex;  
       }  

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
-- There are no messages in this forum --