Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / IoT

Microsoft Band- Basic App for Understanding

3.90/5 (7 votes)
28 Jun 2015CPOL4 min read 11.1K   141  
In this article we will learn how to use Microsoft Band to connect to your Device.

Introduction

Microsoft recently launched a wrist wearable device which provides you the health information of the wearer. It gives you information on Heart Rate, Calories burnt, Body temperature etc which is useful in maintaining a better health. All the information of the person wearing Band is transmitted to the Microsoft server using Microsoft Health Services. And with the help of this historic data the health report analysis can be done.
In this article we will learn how to use Microsoft Band to connect to your Device.

Background

The Band can be connected to your device for example Windows Phone, Tablet, Even Windows 10. You can use the features of Microsoft Band with even Cortana which is a digital assistant of Windows 10. There are a set of APIs which are available in the market. Remember you don't develop applications for Microsoft Band. It is just a client or you can call it a User Interface. The application needs to be developed on the proper platform like Windows Phone or tablet or desktop, and then the Microsoft Band will be acting as a client for viewing information on the same.

Microsoft Band connects to devices using Blue-tooth, which if kept connected for long hours will reduce the battery of both the devices.

In the application in this article, we will be learning on how to see the Hearth Rate of the Microsoft Band wearer to the Phone with which the Band is connected to.

The SDK is available in the following URL along with the documentation - http://developer.microsoftband.com/ and is compatible with the latest version of IDEs.

And for making an app so that the same can connect to the Band you have to know the application knowledge as a pre requisite.

Using the code

For this article, we will be working on Visual Studios 2013 Ultimate.

Step 1 - Open a new Universal Apps project, and name it accordingly. I am naming it - BandApp1

Image 1

Step 2 - There will be 3 projects in the solution, but as we are working on Windows Phone app, so make <ProjectName>.WindowsPhone project as the start up project

Step 3 - Right click on the project and go to manage Nugets and Search for Microsoft.Band and then add it to your project. Verify that the references of Microsoft.Band, Microsoft.Band.Phone & Microsoft.Band.Store are present in your solution

Image 2

Image 3

Step 4 - Create a simple XAML structure, which has 4 TextBlock(2 for Status and 2 for Heart Rate) along with 2 buttons

Step 5 - Go to the code behind and write the following code.

Image 4

The execution starts from the OnNavigatedTo which we are supposed to have an asyn call. And the part of the code is supposed to be executed at the init of the application, for which we are supposed to have the condition check of NavigationMode
Post that with the help of BandClientManager (which resides in Microsoft.Band namespace) we try to connect with the Band.

In the below screenshot we are having a set of items in the Sensors which can be used from the application to collect data -

Image 5

And the final call is made for reading the data from the device -

Image 6

And here is a set of images where we can see the output of the Application reading Heart rate data of the person wearing the Microsoft Band -

Image 7

The app asks for the Authorization for the first time -

Image 8

Post Grant of access, the application starts reading the data once the user taps the Start Button -

Image 9

And this is the last state where we get the rate once the stop button is Tapped.

Image 10

Points of Interest

The Microsoft Band is a shift when it comes to IoT (Internet of things) with connection to the Medical science.
Even the game experience can be enhanced if used properly, for example if the health bar is replaced by Band and the game character's health is dependent on the person wearing the Band.

In the next article we will be learning about creation of Application which will be using Microsoft Band as interface.

The same solution is attached in the Article for reference, please use it as per the requirement. Given the application will run on a device instead of Emulator because Emulator cant be connected to Microsoft Band.

License

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