First impression of Microsoft Band – developing

Intro:

The Band SDK was made available last week and now we will see what we can do. First the SDK is really a nuget package which makes it super easy to use and install. There are also a SDK for Android and iOS is coming soon according to the Band SDK home page (http://developer.microsoftband.com/)

There are also sample code which after a first glance demos all of the Bands functionality.

First I made a Universal app and put the nuget package in both projects. This however did not work. The Windows version doesn’t compile. I seems it looks in the wrong directory when looking for its files. I copied Microsoft.Band.Store catalog to another place to make it compile. You also need to add the bluetooth capability to the windows project appxmanifest like so:

For phone this is added when you add the nuget package. But when I started to develop it can’t find the BandClientManager, its there for the phone but not the windows project. You need this to connect so for now only phone works, at least I couldn’t find any way to get it to work. If you can please share in the comments below. But since this is a preview hopefully the issues will be solved later on.

Sensors:

Lets start and see how we can get hold of the sensor data and what data we can get. There are eight sensors in the SDK:

Accelerometer

Distance

Gyroscope

HeartRate

Pedometer

SkinTemperature

Ultraviolet

Contact

and the are all easy to access. The code is quite simple.

After all ReadingChanged are hooked up this is how one retrieves data from the sensors.

In my example all I’m doing is displaying data on the screen but one can of course do something exciting with it.

And after the app is done reading one calls StopReadingsAsync for the sensors you don’t want any more data from.

Send data to the Band

Vibrate

Now that we can get data from Band how do we send data to it? We start by making it vibrate.

very easy indeed.

Add/remove tile

This is the code to add a tile

The LoadIcon function is a must since the icon must be of BandIcon type. I have taken the function straight from the sample code.

And if you for some reason want to remove the tile you run this code

Sending data to the tile

You can send a “toast” to the Band after you have your tile on it.

This shows up on the band and after it is dismissed its gone. If you want the toast but still want the info be available when you click the tile, you send

And if you only want the text on the tile but not showing a toast, you send

Change color and background image

There are also a possibility to change the color and the background image of the Band. I not sure why one want a app to change this since this is something you set to fit your personality. You can for example don´t change the phone color from apps, you can get the selected color but don’t change it.

Summary

Its quite easy to get and set data from the Band. If you have an app that people open often to see short info you should definitely create a tile for the Band and send data  to it. I haven’t done any analysis of the sensor data you get from the app (perhaps another blog in the future) but there are many possibilities for what one can do with this. So just code away and either make your app use the Band for showing info or make use of the sensor data you can get from it.

This Post Has 3 Comments

  1. I can confirm that bit of xml for the capabilities node is required for phone app as well, if I do not include it then the code gets an exception at the ‘ConnectAsync’ line and returns an exception message of ‘Service’. Your post did the trick for me, thank you!

  2. Have you tried playing around with layouts and buttons? I’ve managed to create a button but I’m getting issues with the event handlers. They don’t seem to get called. I’m using info in latest SDK doco.

  3. Hi. Have you managed to get buttons to work with the updated SDK?

Leave a Reply

Close Menu